summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2013-09-26 17:09:28 +0000
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>2013-09-26 17:09:28 +0000
commitdaf6b948b98b886f5f0fba130e91e01c9ca7c2f2 (patch)
treebebc064f60ea8772027d050388b0fc18b8b10758 /lib/Target/PowerPC
parent6c73cf5a8aef28e4274a0d843940fdee0d9f7329 (diff)
downloadllvm-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.cpp4
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;
}