[PATCH] D26290: Only consider local functions local for the purpose of NOP eliminate after calls on PPC64
Joerg Sonnenberger via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 4 14:13:22 PDT 2016
joerg removed rL LLVM as the repository for this revision.
joerg updated this revision to Diff 76943.
joerg added a comment.
Update the one user of isLocalCall to drop the now redundant PIC check.
https://reviews.llvm.org/D26290
Files:
lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/call-nop.ll
Index: test/CodeGen/PowerPC/call-nop.ll
===================================================================
--- test/CodeGen/PowerPC/call-nop.ll
+++ test/CodeGen/PowerPC/call-nop.ll
@@ -0,0 +1,27 @@
+; RUN: llc -O2 < %s | FileCheck %s
+
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64--linux"
+
+ at f.x = internal global i32 0, align 4
+
+; Function Attrs: noinline nounwind
+define signext i32 @f() noinline {
+ %1 = load volatile i32, i32* @f.x, align 4
+ ret i32 %1
+}
+
+; Function Attrs: nounwind
+define signext i32 @g() {
+ %1 = call signext i32 @f()
+ %2 = call signext i32 @f()
+ %3 = add nsw i32 %1, %2
+ ret i32 %3
+}
+
+; CHECK-LABEL: @g
+; CHECK: bl f
+; CHECK-NEXT: nop
+; CHECK: bl f
+; CHECK-NEXT: nop
+
Index: lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- lib/Target/PowerPC/PPCISelLowering.cpp
+++ lib/Target/PowerPC/PPCISelLowering.cpp
@@ -4549,7 +4606,7 @@
bool isLocalCall(const SDValue &Callee)
{
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
- return G->getGlobal()->isStrongDefinitionForLinker();
+ return G->getGlobal()->hasLocalLinkage();
return false;
}
@@ -4677,9 +4734,7 @@
// The address needs to go after the chain input but before the flag (or
// any other variadic arguments).
Ops.insert(std::next(Ops.begin()), AddTOC);
- } else if ((CallOpc == PPCISD::CALL) &&
- (!isLocalCall(Callee) ||
- DAG.getTarget().getRelocationModel() == Reloc::PIC_))
+ } else if (CallOpc == PPCISD::CALL && !isLocalCall(Callee))
// Otherwise insert NOP for non-local calls.
CallOpc = PPCISD::CALL_NOP;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26290.76943.patch
Type: text/x-patch
Size: 1730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161104/90581b90/attachment.bin>
More information about the llvm-commits
mailing list