OSDN Git Service

[OperandBundles] Have TailCallElim play nice with operand bundles
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 23 Dec 2015 09:58:43 +0000 (09:58 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 23 Dec 2015 09:58:43 +0000 (09:58 +0000)
A call site's use of a Value might not correspond to an argument
operand but to a bundle operand.

This fixes PR25928.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256328 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/TailRecursionElimination.cpp
test/Transforms/TailCallElim/basic.ll

index 7e1ba2c..0e0b00d 100644 (file)
@@ -197,8 +197,8 @@ struct AllocaDerivedValueTracker {
       case Instruction::Call:
       case Instruction::Invoke: {
         CallSite CS(I);
-        bool IsNocapture = !CS.isCallee(U) &&
-                           CS.doesNotCapture(CS.getArgumentNo(U));
+        bool IsNocapture =
+            CS.isDataOperand(U) && CS.doesNotCapture(CS.getDataOperandNo(U));
         callUsesLocalStack(CS, IsNocapture);
         if (IsNocapture) {
           // If the alloca-derived argument is passed in as nocapture, then it
index fe8bbe9..b303fa7 100644 (file)
@@ -188,3 +188,13 @@ define void @test11() {
 ; CHECK: call void @test11_helper2
   ret void
 }
+
+; PR25928
+define void @test12() {
+entry:
+; CHECK-LABEL: @test12
+; CHECK: {{^ *}} call void undef(i8* undef) [ "foo"(i8* %e) ]
+  %e = alloca i8
+  call void undef(i8* undef) [ "foo"(i8* %e) ]
+  unreachable
+}