diff options
author | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2013-09-26 17:09:28 +0000 |
---|---|---|
committer | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2013-09-26 17:09:28 +0000 |
commit | daf6b948b98b886f5f0fba130e91e01c9ca7c2f2 (patch) | |
tree | bebc064f60ea8772027d050388b0fc18b8b10758 /lib/Target/PowerPC | |
parent | 6c73cf5a8aef28e4274a0d843940fdee0d9f7329 (diff) | |
download | llvm-daf6b948b98b886f5f0fba130e91e01c9ca7c2f2.tar.gz llvm-daf6b948b98b886f5f0fba130e91e01c9ca7c2f2.tar.bz2 llvm-daf6b948b98b886f5f0fba130e91e01c9ca7c2f2.tar.xz |
[PowerPC] Fix PR17354: Generate nop after local calls for PIC code.
When generating code for shared libraries, even local calls may be
intercepted, so we need a nop after the call for the linker to fix up the
TOC. Test case adapted from the one provided in PR17354.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC')
-rw-r--r-- | lib/Target/PowerPC/PPCISelLowering.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 5e12664e72..8da5f0563c 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -3487,7 +3487,9 @@ PPCTargetLowering::FinishCall(CallingConv::ID CallConv, SDLoc dl, // from allocating it), resulting in an additional register being // allocated and an unnecessary move instruction being generated. needsTOCRestore = true; - } else if ((CallOpc == PPCISD::CALL) && !isLocalCall(Callee)) { + } else if ((CallOpc == PPCISD::CALL) && + (!isLocalCall(Callee) || + DAG.getTarget().getRelocationModel() == Reloc::PIC_)) { // Otherwise insert NOP for non-local calls. CallOpc = PPCISD::CALL_NOP; } |