<div dir="ltr">Hey Hal, as discussed on IRC, this is causing a miscompile on PPC.<div><br></div><div>It appears that this miscompiles non-virtual thunk (trampoline in PPC parlance I think?) in some cases with shared objects.</div><div><br></div><div>Here is the assembly of the thunk we think is leading to a segfault:</div><div><pre style="user-select: text; top: -99px;">_ZThn8_<snip>:
.Lfunc_begin260:
        .loc    7 0 0
        .cfi_startproc
.Lfunc_gep260:
        addis 2, 12, .TOC.-.Lfunc_gep260@ha
        addi 2, 2, .TOC.-.Lfunc_gep260@l
.Lfunc_lep260:
        .localentry     _ZThn8_<snip>, .Lfunc_lep260-.Lfunc_gep260
# BB#0:
        mr 4, 6
        #DEBUG_VALUE: this <- [%X1+-16]
        #DEBUG_VALUE: delay <- [%X1+-24]
        #DEBUG_VALUE: c <- [%X1+-32]
        #DEBUG_VALUE: priority <- [%X1+-36]
        #DEBUG_VALUE: key <- [%X1+-48]
        std 3, -16(1)
        addi 3, 1, -24
        stxsdx 1, 0, 3
        std 5, -32(1)
        stw 4, -36(1)
        std 7, -48(1)
.Ltmp1549:
        ld 5, -16(1)
        addi 5, 5, -8
        lxsdx 1, 0, 3
        ld 3, -32(1)
        lwz 4, -36(1)
                                        # implicit-def: %X6
        mr 6, 4
        clrldi   6, 6, 32
        stggd 3, -56(1)                   # 8-byte Folded Spill
        mr 3, 5
        ld 5, -56(1)                    # 8-byte Folded Reload
        b _Z<snip>
        #TC_RETURNd8 _Z<snip> 0
.Ltmp1550:</pre></div><div><br></div><div>And this is the IR for that trampoline:</div><div><pre style="user-select: text; top: -99px;">define void @_ZThn8_<snip>(%"<snip>"*, double, %class.<snip>*, i32 zeroext, %"<snip>"*) {
  %6 = alloca %"<snip>"*, align 8
  %7 = alloca double, align 8
  %8 = alloca %class.<snip>*, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"<snip>"*, align 8
  store %"<snip>"* %0, %"<snip>"** %6, align 8
  call void @llvm.dbg.declare(metadata %"<snip>"** %6, metadata !23009, metadata !16176), !dbg !23010
  store double %1, double* %7, align 8
  call void @llvm.dbg.declare(metadata double* %7, metadata !23011, metadata !16176), !dbg !23012
  store %class.<snip>* %2, %class.<snip>** %8, align 8
  call void @llvm.dbg.declare(metadata %class.<snip>** %8, metadata !23013, metadata !16176), !dbg !23014
  store i32 %3, i32* %9, align 4
  call void @llvm.dbg.declare(metadata i32* %9, metadata !23015, metadata !16176), !dbg !23016
  store %"<snip>"* %4, %"<snip>"** %10, align 8
  call void @llvm.dbg.declare(metadata %"<snip>"** %10, metadata !23017, metadata !16176), !dbg !23018
  %11 = load %"<snip>"*, %"<snip>"** %6, align 8, !dbg !23010
  %12 = bitcast %"<snip>"* %11 to i8*, !dbg !23010
  %13 = getelementptr inbounds i8, i8* %12, i64 -8, !dbg !23010
  %14 = bitcast i8* %13 to %"<snip>"*, !dbg !23010
  %15 = load double, double* %7, align 8, !dbg !23010
  %16 = load %class.<snip>*, %class.<snip>** %8, align 8, !dbg !23010
  %17 = load i32, i32* %9, align 4, !dbg !23010
  %18 = load %"<snip>"*, %"<snip>"** %10, align 8, !dbg !23010
  tail call void @_<snip>(%"<snip>"* %14, double %15, %class.<snip>* %16, i32 zeroext %17, %"<snip>"* %18), !dbg !23010
  ret void, !dbg !23010
}</pre></div><div><br></div><div>From the analysis Kyle did it appears to be corrupting the saved r2 in the caller of the trampoline (which calls it indirectly through a vtable) thus causing a corrupt r2 to be restored afterward.</div><div><br></div><div>If this isn't enough to understand the bug Kyle shoudl be able to help dig into a more refined test case on Monday at the latest.</div><div><br></div><div>Based on our discussion on IRC, I'm reverting until we sort this out as it is blocking us using LLVM on PPC right now.</div><div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 13, 2016 at 11:35 PM Hal Finkel via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: hfinkel<br class="gmail_msg">
Date: Wed Dec 14 01:24:50 2016<br class="gmail_msg">
New Revision: 289638<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=289638&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=289638&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility)<br class="gmail_msg">
<br class="gmail_msg">
This change aims to unify and correct our logic for when we need to allow for<br class="gmail_msg">
the possibility of the linker adding a TOC restoration instruction after a<br class="gmail_msg">
call. This comes up in two contexts:<br class="gmail_msg">
<br class="gmail_msg">
 1. When determining tail-call eligibility. If we make a tail call (i.e.<br class="gmail_msg">
    directly branch to a function) then there is no place for the linker to add<br class="gmail_msg">
    a TOC restoration.<br class="gmail_msg">
 2. When determining when we need to add a nop instruction after a call.<br class="gmail_msg">
    Likewise, if there is a possibility that the linker might need to add a<br class="gmail_msg">
    TOC restoration after a call, then we need to put a nop after the call<br class="gmail_msg">
    (the bl instruction).<br class="gmail_msg">
<br class="gmail_msg">
First problem: We were using similar, but different, logic to decide (1) and<br class="gmail_msg">
(2). This is just wrong. Both the resideInSameModule function (used when<br class="gmail_msg">
determining tail-call eligibility) and the isLocalCall function (used when<br class="gmail_msg">
deciding if the post-call nop is needed) were supposed to be determining the<br class="gmail_msg">
same underlying fact (i.e. might a TOC restoration be needed after the call).<br class="gmail_msg">
The same logic should be used in both places.<br class="gmail_msg">
<br class="gmail_msg">
Second problem: The logic in both places was wrong. We only know that two<br class="gmail_msg">
functions will share the same TOC when both functions come from the same<br class="gmail_msg">
section of the same object. Otherwise the linker might cause the functions to<br class="gmail_msg">
use different TOC base addresses (unless the multi-TOC linker option is<br class="gmail_msg">
disabled, in which case only shared-library boundaries are relevant). There are<br class="gmail_msg">
a number of factors that can cause functions to be placed in different sections<br class="gmail_msg">
or come from different objects (-ffunction-sections, explicitly-specified<br class="gmail_msg">
section names, COMDAT, weak linkage, etc.). All of these need to be checked.<br class="gmail_msg">
The existing logic only checked properties of the callee, but the properties of<br class="gmail_msg">
the caller must also be checked (for example, calling from a function in a<br class="gmail_msg">
COMDAT section means calling between sections).<br class="gmail_msg">
<br class="gmail_msg">
There was a conceptual error in the resideInSameModule function in that it<br class="gmail_msg">
allowed tail calls to functions with weak linkage and protected/hidden<br class="gmail_msg">
visibility. While protected/hidden visibility does prevent the function<br class="gmail_msg">
implementation from being replaced at runtime (via interposition), it does not<br class="gmail_msg">
prevent the linker from using an alternate implementation at link time (i.e.<br class="gmail_msg">
using some strong definition to replace the provided weak one during linking).<br class="gmail_msg">
If this happens, then we're still potentially looking at a required TOC<br class="gmail_msg">
restoration upon return.<br class="gmail_msg">
<br class="gmail_msg">
Otherwise, in general, the post-call nop is needed wherever ELF interposition<br class="gmail_msg">
needs to be supported. We don't currently support ELF interposition at the IR<br class="gmail_msg">
level (see <a href="http://lists.llvm.org/pipermail/llvm-dev/2016-November/107625.html" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/pipermail/llvm-dev/2016-November/107625.html</a><br class="gmail_msg">
for more information), and I don't think we should try to make it appear to<br class="gmail_msg">
work in the backend in spite of that fact. This will yield subtle bugs if<br class="gmail_msg">
interposition is attempted. As a result, regardless of whether we're in PIC<br class="gmail_msg">
mode, we don't assume that we need to add the nop to support the possibility of<br class="gmail_msg">
ELF interposition. However, the necessary check is in place (i.e. calling<br class="gmail_msg">
GV->isInterposable and TM.shouldAssumeDSOLocal) so when we have functions for<br class="gmail_msg">
which interposition is allowed at the IR level, we'll add the nop as necessary.<br class="gmail_msg">
In the mean time, we'll generate more tail calls and fewer nops when compiling<br class="gmail_msg">
position-independent code.<br class="gmail_msg">
<br class="gmail_msg">
Differential Revision: <a href="https://reviews.llvm.org/D27231" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D27231</a><br class="gmail_msg">
<br class="gmail_msg">
Added:<br class="gmail_msg">
    llvm/trunk/test/CodeGen/PowerPC/ppc64-blnop.ll<br class="gmail_msg">
Modified:<br class="gmail_msg">
    llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp<br class="gmail_msg">
    llvm/trunk/test/CodeGen/PowerPC/ppc64-sibcall.ll<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=289638&r1=289637&r2=289638&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=289638&r1=289637&r2=289638&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Dec 14 01:24:50 2016<br class="gmail_msg">
@@ -3981,40 +3981,32 @@ static int CalculateTailCallSPDiff(Selec<br class="gmail_msg">
 static bool isFunctionGlobalAddress(SDValue Callee);<br class="gmail_msg">
<br class="gmail_msg">
 static bool<br class="gmail_msg">
-resideInSameModule(SDValue Callee, Reloc::Model RelMod) {<br class="gmail_msg">
+resideInSameSection(const Function *Caller, SDValue Callee,<br class="gmail_msg">
+                    const TargetMachine &TM) {<br class="gmail_msg">
   // If !G, Callee can be an external symbol.<br class="gmail_msg">
   GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);<br class="gmail_msg">
-  if (!G) return false;<br class="gmail_msg">
+  if (!G)<br class="gmail_msg">
+    return false;<br class="gmail_msg">
<br class="gmail_msg">
   const GlobalValue *GV = G->getGlobal();<br class="gmail_msg">
-<br class="gmail_msg">
-  if (GV->isDeclaration()) return false;<br class="gmail_msg">
-<br class="gmail_msg">
-  switch(GV->getLinkage()) {<br class="gmail_msg">
-  default: llvm_unreachable("unknow linkage type");<br class="gmail_msg">
-  case GlobalValue::AvailableExternallyLinkage:<br class="gmail_msg">
-  case GlobalValue::ExternalWeakLinkage:<br class="gmail_msg">
+  if (!GV->isStrongDefinitionForLinker())<br class="gmail_msg">
     return false;<br class="gmail_msg">
<br class="gmail_msg">
-  // Callee with weak linkage is allowed if it has hidden or protected<br class="gmail_msg">
-  // visibility<br class="gmail_msg">
-  case GlobalValue::LinkOnceAnyLinkage:<br class="gmail_msg">
-  case GlobalValue::LinkOnceODRLinkage: // e.g. c++ inline functions<br class="gmail_msg">
-  case GlobalValue::WeakAnyLinkage:<br class="gmail_msg">
-  case GlobalValue::WeakODRLinkage:     // e.g. c++ template instantiation<br class="gmail_msg">
-    if (GV->hasDefaultVisibility())<br class="gmail_msg">
+  // Any explicitly-specified sections and section prefixes must also match.<br class="gmail_msg">
+  // Also, if we're using -ffunction-sections, then each function is always in<br class="gmail_msg">
+  // a different section (the same is true for COMDAT functions).<br class="gmail_msg">
+  if (TM.getFunctionSections() || GV->hasComdat() || Caller->hasComdat() ||<br class="gmail_msg">
+      GV->getSection() != Caller->getSection())<br class="gmail_msg">
+    return false;<br class="gmail_msg">
+  if (const auto *F = dyn_cast<Function>(GV)) {<br class="gmail_msg">
+    if (F->getSectionPrefix() != Caller->getSectionPrefix())<br class="gmail_msg">
       return false;<br class="gmail_msg">
-<br class="gmail_msg">
-  case GlobalValue::ExternalLinkage:<br class="gmail_msg">
-  case GlobalValue::InternalLinkage:<br class="gmail_msg">
-  case GlobalValue::PrivateLinkage:<br class="gmail_msg">
-    break;<br class="gmail_msg">
   }<br class="gmail_msg">
<br class="gmail_msg">
-  // With '-fPIC', calling default visiblity function need insert 'nop' after<br class="gmail_msg">
-  // function call, no matter that function resides in same module or not, so<br class="gmail_msg">
-  // we treat it as in different module.<br class="gmail_msg">
-  if (RelMod == Reloc::PIC_ && GV->hasDefaultVisibility())<br class="gmail_msg">
+  // If the callee might be interposed, then we can't assume the ultimate call<br class="gmail_msg">
+  // target will be in the same section.<br class="gmail_msg">
+  if (GV->isInterposable() &&<br class="gmail_msg">
+      !TM.shouldAssumeDSOLocal(*Caller->getParent(), GV))<br class="gmail_msg">
     return false;<br class="gmail_msg">
<br class="gmail_msg">
   return true;<br class="gmail_msg">
@@ -4130,11 +4122,11 @@ PPCTargetLowering::IsEligibleForTailCall<br class="gmail_msg">
       !isa<ExternalSymbolSDNode>(Callee))<br class="gmail_msg">
     return false;<br class="gmail_msg">
<br class="gmail_msg">
-  // Check if Callee resides in the same module, because for now, PPC64 SVR4 ABI<br class="gmail_msg">
-  // (ELFv1/ELFv2) doesn't allow tail calls to a symbol resides in another<br class="gmail_msg">
-  // module.<br class="gmail_msg">
+  // Check if Callee resides in the same section, because for now, PPC64 SVR4<br class="gmail_msg">
+  // ABI (ELFv1/ELFv2) doesn't allow tail calls to a symbol resides in another<br class="gmail_msg">
+  // section.<br class="gmail_msg">
   // ref: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=973977" rel="noreferrer" class="gmail_msg" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=973977</a><br class="gmail_msg">
-  if (!resideInSameModule(Callee, getTargetMachine().getRelocationModel()))<br class="gmail_msg">
+  if (!resideInSameSection(MF.getFunction(), Callee, getTargetMachine()))<br class="gmail_msg">
     return false;<br class="gmail_msg">
<br class="gmail_msg">
   // TCO allows altering callee ABI, so we don't have to check further.<br class="gmail_msg">
@@ -4592,14 +4584,6 @@ PrepareCall(SelectionDAG &DAG, SDValue &<br class="gmail_msg">
   return CallOpc;<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
-static<br class="gmail_msg">
-bool isLocalCall(const SDValue &Callee)<br class="gmail_msg">
-{<br class="gmail_msg">
-  if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))<br class="gmail_msg">
-    return G->getGlobal()->isStrongDefinitionForLinker();<br class="gmail_msg">
-  return false;<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
 SDValue PPCTargetLowering::LowerCallResult(<br class="gmail_msg">
     SDValue Chain, SDValue InFlag, CallingConv::ID CallConv, bool isVarArg,<br class="gmail_msg">
     const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &dl,<br class="gmail_msg">
@@ -4701,6 +4685,7 @@ SDValue PPCTargetLowering::FinishCall(<br class="gmail_msg">
   // stack frame. If caller and callee belong to the same module (and have the<br class="gmail_msg">
   // same TOC), the NOP will remain unchanged.<br class="gmail_msg">
<br class="gmail_msg">
+  MachineFunction &MF = DAG.getMachineFunction();<br class="gmail_msg">
   if (!isTailCall && Subtarget.isSVR4ABI()&& Subtarget.isPPC64() &&<br class="gmail_msg">
       !isPatchPoint) {<br class="gmail_msg">
     if (CallOpc == PPCISD::BCTRL) {<br class="gmail_msg">
@@ -4724,11 +4709,11 @@ SDValue PPCTargetLowering::FinishCall(<br class="gmail_msg">
       // The address needs to go after the chain input but before the flag (or<br class="gmail_msg">
       // any other variadic arguments).<br class="gmail_msg">
       Ops.insert(std::next(Ops.begin()), AddTOC);<br class="gmail_msg">
-    } else if ((CallOpc == PPCISD::CALL) &&<br class="gmail_msg">
-               (!isLocalCall(Callee) ||<br class="gmail_msg">
-                DAG.getTarget().getRelocationModel() == Reloc::PIC_))<br class="gmail_msg">
+    } else if (CallOpc == PPCISD::CALL &&<br class="gmail_msg">
+      !resideInSameSection(MF.getFunction(), Callee, DAG.getTarget())) {<br class="gmail_msg">
       // Otherwise insert NOP for non-local calls.<br class="gmail_msg">
       CallOpc = PPCISD::CALL_NOP;<br class="gmail_msg">
+    }<br class="gmail_msg">
   }<br class="gmail_msg">
<br class="gmail_msg">
   Chain = DAG.getNode(CallOpc, dl, NodeTys, Ops);<br class="gmail_msg">
<br class="gmail_msg">
Added: llvm/trunk/test/CodeGen/PowerPC/ppc64-blnop.ll<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc64-blnop.ll?rev=289638&view=auto" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc64-blnop.ll?rev=289638&view=auto</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/test/CodeGen/PowerPC/ppc64-blnop.ll (added)<br class="gmail_msg">
+++ llvm/trunk/test/CodeGen/PowerPC/ppc64-blnop.ll Wed Dec 14 01:24:50 2016<br class="gmail_msg">
@@ -0,0 +1,129 @@<br class="gmail_msg">
+; RUN: llc < %s -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s<br class="gmail_msg">
+; RUN: llc < %s -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s<br class="gmail_msg">
+; RUN: llc < %s -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s<br class="gmail_msg">
+; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s<br class="gmail_msg">
+; RUN: llc < %s -function-sections -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=CHECK-FS<br class="gmail_msg">
+; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s<br class="gmail_msg">
+; RUN: llc < %s -function-sections -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=CHECK-FS<br class="gmail_msg">
+<br class="gmail_msg">
+%class.T = type { [2 x i8] }<br class="gmail_msg">
+<br class="gmail_msg">
+define void @e_callee(%class.T* %this, i8* %c) { ret void }<br class="gmail_msg">
+define void @e_caller(%class.T* %this, i8* %c) {<br class="gmail_msg">
+  call void @e_callee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: e_caller:<br class="gmail_msg">
+; CHECK: bl e_callee<br class="gmail_msg">
+; CHECK-NOT: nop<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-FS-LABEL: e_caller:<br class="gmail_msg">
+; CHECK-FS: bl e_callee<br class="gmail_msg">
+; CHECK-FS-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define void @e_scallee(%class.T* %this, i8* %c) section "different" { ret void }<br class="gmail_msg">
+define void @e_scaller(%class.T* %this, i8* %c) {<br class="gmail_msg">
+  call void @e_scallee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: e_scaller:<br class="gmail_msg">
+; CHECK: bl e_scallee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define void @e_s2callee(%class.T* %this, i8* %c) { ret void }<br class="gmail_msg">
+define void @e_s2caller(%class.T* %this, i8* %c) section "different" {<br class="gmail_msg">
+  call void @e_s2callee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: e_s2caller:<br class="gmail_msg">
+; CHECK: bl e_s2callee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+$cd1 = comdat any<br class="gmail_msg">
+$cd2 = comdat any<br class="gmail_msg">
+<br class="gmail_msg">
+define void @e_ccallee(%class.T* %this, i8* %c) comdat($cd1) { ret void }<br class="gmail_msg">
+define void @e_ccaller(%class.T* %this, i8* %c) comdat($cd2) {<br class="gmail_msg">
+  call void @e_ccallee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: e_ccaller:<br class="gmail_msg">
+; CHECK: bl e_ccallee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+$cd = comdat any<br class="gmail_msg">
+<br class="gmail_msg">
+define void @e_c1callee(%class.T* %this, i8* %c) comdat($cd) { ret void }<br class="gmail_msg">
+define void @e_c1caller(%class.T* %this, i8* %c) comdat($cd) {<br class="gmail_msg">
+  call void @e_c1callee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: e_c1caller:<br class="gmail_msg">
+; CHECK: bl e_c1callee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define weak_odr hidden void @wo_hcallee(%class.T* %this, i8* %c) { ret void }<br class="gmail_msg">
+define void @wo_hcaller(%class.T* %this, i8* %c) {<br class="gmail_msg">
+  call void @wo_hcallee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: wo_hcaller:<br class="gmail_msg">
+; CHECK: bl wo_hcallee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define weak_odr protected void @wo_pcallee(%class.T* %this, i8* %c) { ret void }<br class="gmail_msg">
+define void @wo_pcaller(%class.T* %this, i8* %c) {<br class="gmail_msg">
+  call void @wo_pcallee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: wo_pcaller:<br class="gmail_msg">
+; CHECK: bl wo_pcallee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define weak_odr void @wo_callee(%class.T* %this, i8* %c) { ret void }<br class="gmail_msg">
+define void @wo_caller(%class.T* %this, i8* %c) {<br class="gmail_msg">
+  call void @wo_callee(%class.T* %this, i8* %c)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: wo_caller:<br class="gmail_msg">
+; CHECK: bl wo_callee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define weak protected void @w_pcallee(i8* %ptr) { ret void }<br class="gmail_msg">
+define void @w_pcaller(i8* %ptr) {<br class="gmail_msg">
+  call void @w_pcallee(i8* %ptr)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: w_pcaller:<br class="gmail_msg">
+; CHECK: bl w_pcallee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define weak hidden void @w_hcallee(i8* %ptr) { ret void }<br class="gmail_msg">
+define void @w_hcaller(i8* %ptr) {<br class="gmail_msg">
+  call void @w_hcallee(i8* %ptr)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: w_hcaller:<br class="gmail_msg">
+; CHECK: bl w_hcallee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+define weak void @w_callee(i8* %ptr) { ret void }<br class="gmail_msg">
+define void @w_caller(i8* %ptr) {<br class="gmail_msg">
+  call void @w_callee(i8* %ptr)<br class="gmail_msg">
+  ret void<br class="gmail_msg">
+<br class="gmail_msg">
+; CHECK-LABEL: w_caller:<br class="gmail_msg">
+; CHECK: bl w_callee<br class="gmail_msg">
+; CHECK-NEXT: nop<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/test/CodeGen/PowerPC/ppc64-sibcall.ll<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc64-sibcall.ll?rev=289638&r1=289637&r2=289638&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc64-sibcall.ll?rev=289638&r1=289637&r2=289638&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/test/CodeGen/PowerPC/ppc64-sibcall.ll (original)<br class="gmail_msg">
+++ llvm/trunk/test/CodeGen/PowerPC/ppc64-sibcall.ll Wed Dec 14 01:24:50 2016<br class="gmail_msg">
@@ -142,7 +142,7 @@ define void @wo_hcaller(%class.T* %this,<br class="gmail_msg">
   ret void<br class="gmail_msg">
<br class="gmail_msg">
 ; CHECK-SCO-LABEL: wo_hcaller:<br class="gmail_msg">
-; CHECK-SCO: b wo_hcallee<br class="gmail_msg">
+; CHECK-SCO: bl wo_hcallee<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
 define weak_odr protected void @wo_pcallee(%class.T* %this, i8* %c) { ret void }<br class="gmail_msg">
@@ -151,7 +151,7 @@ define void @wo_pcaller(%class.T* %this,<br class="gmail_msg">
   ret void<br class="gmail_msg">
<br class="gmail_msg">
 ; CHECK-SCO-LABEL: wo_pcaller:<br class="gmail_msg">
-; CHECK-SCO: b wo_pcallee<br class="gmail_msg">
+; CHECK-SCO: bl wo_pcallee<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
 define weak_odr void @wo_callee(%class.T* %this, i8* %c) { ret void }<br class="gmail_msg">
@@ -169,7 +169,7 @@ define void @w_pcaller(i8* %ptr) {<br class="gmail_msg">
   ret void<br class="gmail_msg">
<br class="gmail_msg">
 ; CHECK-SCO-LABEL: w_pcaller:<br class="gmail_msg">
-; CHECK-SCO: b w_pcallee<br class="gmail_msg">
+; CHECK-SCO: bl w_pcallee<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
 define weak hidden void @w_hcallee(i8* %ptr) { ret void }<br class="gmail_msg">
@@ -178,7 +178,7 @@ define void @w_hcaller(i8* %ptr) {<br class="gmail_msg">
   ret void<br class="gmail_msg">
<br class="gmail_msg">
 ; CHECK-SCO-LABEL: w_hcaller:<br class="gmail_msg">
-; CHECK-SCO: b w_hcallee<br class="gmail_msg">
+; CHECK-SCO: bl w_hcallee<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
 define weak void @w_callee(i8* %ptr) { ret void }<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></div></div>