diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-04-27 21:37:37 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-04-27 21:37:37 +0000 |
commit | d6dbec4c6f2088527ad1080959f597f0ad7ef699 (patch) | |
tree | 010ec5fd288cba622efa0e61566dc94771c20b9d /llvm/lib | |
parent | 485d905510388e2b57375b5d3e70f4e6462eccf9 (diff) | |
download | bcm5719-llvm-d6dbec4c6f2088527ad1080959f597f0ad7ef699.tar.gz bcm5719-llvm-d6dbec4c6f2088527ad1080959f597f0ad7ef699.zip |
[X86] Fix the lowering of TLS calls.
The callseq_end node must be glued with the TLS calls, otherwise,
the generic code will miss the uses of the returned value and will
mark it dead.
Moreover, TLSCall 64-bit pseudo must not set an implicit-use on RDI,
the pseudo uses the symbol address at this point not RDI and the
lowering will do the right thing.
llvm-svn: 267797
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86InstrCompiler.td | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 4c9aac5953a..03de28ed6b0 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -12952,9 +12952,9 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const { Chain = DAG.getCALLSEQ_START(Chain, DAG.getIntPtrConstant(0, DL, true), DL); SDValue Args[] = { Chain, Offset }; Chain = DAG.getNode(X86ISD::TLSCALL, DL, NodeTys, Args); - Chain = - DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, DL, true), - DAG.getIntPtrConstant(0, DL, true), SDValue(), DL); + Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, DL, true), + DAG.getIntPtrConstant(0, DL, true), + Chain.getValue(1), DL); // TLSCALL will be codegen'ed as call. Inform MFI that function has calls. MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo(); diff --git a/llvm/lib/Target/X86/X86InstrCompiler.td b/llvm/lib/Target/X86/X86InstrCompiler.td index faf0f816b5e..8feea124451 100644 --- a/llvm/lib/Target/X86/X86InstrCompiler.td +++ b/llvm/lib/Target/X86/X86InstrCompiler.td @@ -490,10 +490,13 @@ def TLSCall_32 : I<0, Pseudo, (outs), (ins i32mem:$sym), [(X86TLSCall addr:$sym)]>, Requires<[Not64BitMode]>; -// For x86_64, the address of the thunk is passed in %rdi, on return -// the address of the variable is in %rax. All other registers are preserved. +// For x86_64, the address of the thunk is passed in %rdi, but the +// pseudo directly use the symbol, so do not add an implicit use of +// %rdi. The lowering will do the right thing with RDI. +// On return the address of the variable is in %rax. All other +// registers are preserved. let Defs = [RAX, EFLAGS], - Uses = [RSP, RDI], + Uses = [RSP], usesCustomInserter = 1 in def TLSCall_64 : I<0, Pseudo, (outs), (ins i64mem:$sym), "# TLSCall_64", |