<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Done. Thanks!<div><br></div><div>-bw</div><div><br><div style=""><div>On Jul 22, 2014, at 11:39 PM, Nick Lewycky <<a href="mailto:nlewycky@google.com">nlewycky@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra">Bill, please merge this into the 3.5 branch. Thanks!</div><div class="gmail_extra"><br></div><div class="gmail_extra">Nick</div><div class="gmail_extra"><br><div class="gmail_quote">

On 22 July 2014 23:24, Nick Lewycky <span dir="ltr"><<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Author: nicholas<br>
Date: Wed Jul 23 01:24:49 2014<br>
New Revision: 213726<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=213726&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=213726&view=rev</a><br>
Log:<br>
We may visit a call that uses an alloca multiple times in callUsesLocalStack, sometimes with IsNocapture true and sometimes with IsNocapture false. We accidentally skipped work we needed to do in the IsNocapture=false case if we were called with IsNocapture=true the first time. Fixes PR20405!<br>


<br>
Modified:<br>
    llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp<br>
    llvm/trunk/test/Transforms/TailCallElim/basic.ll<br>
<br>
Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=213726&r1=213725&r2=213726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=213726&r1=213725&r2=213726&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Wed Jul 23 01:24:49 2014<br>
@@ -227,12 +227,10 @@ struct AllocaDerivedValueTracker {<br>
   }<br>
<br>
   void callUsesLocalStack(CallSite CS, bool IsNocapture) {<br>
-    // Add it to the list of alloca users. If it's already there, skip further<br>
-    // processing.<br>
-    if (!AllocaUsers.insert(CS.getInstruction()))<br>
-      return;<br>
+    // Add it to the list of alloca users.<br>
+    AllocaUsers.insert(CS.getInstruction());<br>
<br>
-    // If it's nocapture then it can't capture the alloca.<br>
+    // If it's nocapture then it can't capture this alloca.<br>
     if (IsNocapture)<br>
       return;<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/TailCallElim/basic.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailCallElim/basic.ll?rev=213726&r1=213725&r2=213726&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailCallElim/basic.ll?rev=213726&r1=213725&r2=213726&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/test/Transforms/TailCallElim/basic.ll (original)<br>
+++ llvm/trunk/test/Transforms/TailCallElim/basic.ll Wed Jul 23 01:24:49 2014<br>
@@ -174,3 +174,17 @@ if.end:<br>
 return:<br>
   ret void<br>
 }<br>
+<br>
+declare void @test11_helper1(i8** nocapture, i8*)<br>
+declare void @test11_helper2(i8*)<br>
+define void @test11() {<br>
+; CHECK-LABEL: @test11<br>
+; CHECK-NOT: tail<br>
+  %a = alloca i8*<br>
+  %b = alloca i8<br>
+  call void @test11_helper1(i8** %a, i8* %b)  ; a = &b<br>
+  %c = load i8** %a<br>
+  call void @test11_helper2(i8* %c)<br>
+; CHECK: call void @test11_helper2<br>
+  ret void<br>
+}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>
</blockquote></div><br></div></body></html>