Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS with large code model on x86_64-apple-darwin asserts #80831

Closed
nikic opened this issue Feb 6, 2024 · 8 comments · Fixed by #80907
Closed

TLS with large code model on x86_64-apple-darwin asserts #80831

nikic opened this issue Feb 6, 2024 · 8 comments · Fixed by #80907

Comments

@nikic
Copy link
Contributor

nikic commented Feb 6, 2024

target triple = "x86_64-apple-macosx10.12.0"

@g = external thread_local global i8

define ptr @test() {
  ret ptr @g
}

!llvm.module.flags = !{!0}

!0 = !{i32 1, !"Code Model", i32 4}

Results in:

llc: /home/npopov/repos/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:35071: MachineBasicBlock *llvm::X86TargetLowering::EmitLoweredTLSCall(MachineInstr &, MachineBasicBlock *) const: Assertion `MI.getOperand(3).isGlobal() && "This should be a global"' failed.
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 6, 2024

@llvm/issue-subscribers-backend-x86

Author: Nikita Popov (nikic)

```llvm target triple = "x86_64-apple-macosx10.12.0"

@g = external thread_local global i8

define ptr @test() {
ret ptr @g
}

!llvm.module.flags = !{!0}

!0 = !{i32 1, !"Code Model", i32 4}

Results in:

llc: /home/npopov/repos/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:35071: MachineBasicBlock *llvm::X86TargetLowering::EmitLoweredTLSCall(MachineInstr &, MachineBasicBlock *) const: Assertion `MI.getOperand(3).isGlobal() && "This should be a global"' failed.

</details>

@nikic
Copy link
Contributor Author

nikic commented Feb 6, 2024

Without large code model:

# *** IR Dump After Argument Stack Rebase (x86argumentstackrebase) ***:
# Machine code for function test: IsSSA, TracksLiveness

bb.0 (%ir-block.0):
  ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
  TLSCall_64 $rip, 1, $noreg, target-flags(x86-tlvp) @g, $noreg, implicit-def $rax, implicit-def dead $eflags, implicit-def dead $df, implicit $rsp, implicit $ssp
  ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
  %0:gr64 = COPY $rax
  $rax = COPY %0:gr64
  RET 0, $rax

With large code model:

# *** IR Dump After Argument Stack Rebase (x86argumentstackrebase) ***:
# Machine code for function test: IsSSA, TracksLiveness

bb.0 (%ir-block.0):
  ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
  %0:gr64 = MOV64ri32 target-flags(x86-tlvp) @g
  TLSCall_64 killed %0:gr64, 1, $noreg, 0, $noreg, implicit-def $rax, implicit-def dead $eflags, implicit-def dead $df, implicit $rsp, implicit $ssp
  ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
  %1:gr64 = COPY $rax
  $rax = COPY %1:gr64
  RET 0, $rax

@nikic
Copy link
Contributor Author

nikic commented Feb 6, 2024

Bisects to c04a05d @aeubanks

@aeubanks
Copy link
Contributor

aeubanks commented Feb 6, 2024

taking a look

aeubanks added a commit to aeubanks/llvm-project that referenced this issue Feb 6, 2024
OpFlag and WrapperKind should be chosen consistently with each other in regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes llvm#80831.
nikic pushed a commit to nikic/llvm-project that referenced this issue Feb 7, 2024
OpFlag and WrapperKind should be chosen consistently with each other in regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes llvm#80831.
aeubanks added a commit that referenced this issue Feb 7, 2024
OpFlag and WrapperKind should be chosen consistently with each other in
regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes #80831.
@nikic
Copy link
Contributor Author

nikic commented Feb 8, 2024

/cherry-pick 5a83bcc

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 8, 2024
OpFlag and WrapperKind should be chosen consistently with each other in
regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes llvm#80831.

(cherry picked from commit 5a83bcc)
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 8, 2024

/pull-request #81126

@nikic
Copy link
Contributor Author

nikic commented Feb 8, 2024

@EugeneZelenko Backports are tracked on PRs now. The backport issue is closed when the PR is created.

@EugeneZelenko
Copy link
Contributor

@nikic: Shouldn't issue be reopened when starting backport? It was not a case here.

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 9, 2024
OpFlag and WrapperKind should be chosen consistently with each other in
regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes llvm#80831.

(cherry picked from commit 5a83bcc)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
OpFlag and WrapperKind should be chosen consistently with each other in
regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes llvm#80831.

(cherry picked from commit 5a83bcc)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
OpFlag and WrapperKind should be chosen consistently with each other in
regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes llvm#80831.

(cherry picked from commit 5a83bcc)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
OpFlag and WrapperKind should be chosen consistently with each other in
regards to PIC, otherwise we hit asserts later on.

Broken by c04a05d.

Fixes llvm#80831.

(cherry picked from commit 5a83bcc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants