We may visit a call that uses an alloca multiple times in callUsesLocalStack, sometim...
authorNick Lewycky <nicholas@mxc.ca>
Wed, 23 Jul 2014 06:24:49 +0000 (06:24 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 23 Jul 2014 06:24:49 +0000 (06:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213726 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 05b9892470bb8dddebe9fd1af2ec7e8d0b5b85dd..b7580255150c48fae28ff2dbb02a62bb6ffafcca 100644 (file)
@@ -227,12 +227,10 @@ struct AllocaDerivedValueTracker {
   }
 
   void callUsesLocalStack(CallSite CS, bool IsNocapture) {
-    // Add it to the list of alloca users. If it's already there, skip further
-    // processing.
-    if (!AllocaUsers.insert(CS.getInstruction()))
-      return;
+    // Add it to the list of alloca users.
+    AllocaUsers.insert(CS.getInstruction());
 
-    // If it's nocapture then it can't capture the alloca.
+    // If it's nocapture then it can't capture this alloca.
     if (IsNocapture)
       return;
 
index 341736d48ef8aa978595b91572bb5c203fa84266..8e9814b52bbce90e60bf5b6291bc639cef5c71e8 100644 (file)
@@ -174,3 +174,17 @@ if.end:
 return:
   ret void
 }
+
+declare void @test11_helper1(i8** nocapture, i8*)
+declare void @test11_helper2(i8*)
+define void @test11() {
+; CHECK-LABEL: @test11
+; CHECK-NOT: tail
+  %a = alloca i8*
+  %b = alloca i8
+  call void @test11_helper1(i8** %a, i8* %b)  ; a = &b
+  %c = load i8** %a
+  call void @test11_helper2(i8* %c)
+; CHECK: call void @test11_helper2
+  ret void
+}