<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 4, 2015 at 11:05 AM, David Callahan <span dir="ltr"><<a href="mailto:dcallahan@fb.com" target="_blank">dcallahan@fb.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;font-size:14px;font-family:Calibri,sans-serif">
<div>Thanks for the reply.</div>
<div><br>
</div>
<div>The bug is in the alias analysis (lib/Analysis/IPA/GlobalsModRef.cpp) where a variable is not correctly seen as address-taken due to a static initializer. This leads to an invalid loop invariant code motion and a subsequent use of a bad pointer.</div></div></blockquote><div><br>Are there other tests for GlobalsModRef? You could check in test/Analysis for them (or look at the blame history of GlobalsModRef.cpp and see how other changes were tested) to get an idea of how to test changes to that Analysis.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;font-size:14px;font-family:Calibri,sans-serif">
<div><br>
</div>
<div>So clang is correct but  lto introduces a problem. I tried but was unable to reproduce the problem with opt.</div>
<div>The bug can be reproduced with a .ll file but I don’t know how to verify the fix other than running the output of LTO and so would welcome any suggestions.</div>
<div><br>
</div>
<div>david</div>
<div><br>
</div>
<div><br>
</div>
<span style="color:rgb(0,0,0)">
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, February 3, 2015 at 6:20 PM<br>
<span style="font-weight:bold">To: </span>David Callahan <<a href="mailto:dcallahan@fb.com" target="_blank">dcallahan@fb.com</a>><br>
<span style="font-weight:bold">Cc: </span>LLVM Dev Mailing List <<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [LLVMdev] LTO regression test Bug 17623<br>
</div><div><div class="h5">
<div><br>
</div>
<div>
<div>
<p dir="ltr"><br>
On Feb 3, 2015 5:57 PM, "David Callahan" <<a href="mailto:dcallahan@fb.com" target="_blank">dcallahan@fb.com</a>> wrote:<br>
><br>
> Hello, <br>
><br>
> I have a fix for Bug17623 (<a href="https://urldefense.proofpoint.com/v1/url?u=http://llvm.org/bugs/show_bug.cgi?id%3D17623&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=8am7JZUn9ir%2BIPWQGSonqw%3D%3D%0A&m=%2B%2Bkxr1kNzm83C5RPkRlha1d0eUWXp7eVGgXWS%2F0MCDk%3D%0A&s=1fa398a9f03fc233090f7998fbbfd44c2cac26608bd90c07657af5f21ae80c85" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=17623</a>)
 but I am not sure how best to install a regression test. The commands I use to run the test are (approximately) <br>
><br>
> $LLVM/clang -flto -O2 -o BUG.o -c  BUG.c<br>
> $LLVM/llvm-lto -exported-symbol=main -o lto.o BUG.o<br>
> $LLVM/clang -o bug lto.o<br>
> ./bug<br>
><br>
> Where the failing behavior is to seg fault and corrected behavior is to run to completion.<br>
> The use of llvm-lto avoids a dependence on the native loader having appropriate plugin support.<br>
><br>
> The reliance on running clang and code suggests a test belongs in the llvm-test-suite.</p>
<p dir="ltr">Not necessarily. It depends where the bug is. If clang is producing wrong IR and needs to be changed, we just test clang and verify that the desired IR doesn't have the erroneous feature that wr removed.</p>
<p dir="ltr">Alternatively, if clang is doing the right thing and the llvm IR linker is mangling the result, or the llvm optimizations misunderstand - we should just be able to construct the minimal IR that demonstrates the poor behavior and verify llvm gets
 the right answer.</p>
<p dir="ltr">So where is the bug?</p>
<p dir="ltr">> Could someone give me a pointer on how to configure a test using commands like the above? Are there any other tests with a</p>
</div>
</div>
</div></div></span><div><div class="h5"><span style="color:rgb(0,0,0)">
<div>
<div>
<p dir="ltr">similar structure?<br>
><br>
> Thanks<br>
> david<br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="https://urldefense.proofpoint.com/v1/url?u=http://llvm.cs.uiuc.edu&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=8am7JZUn9ir%2BIPWQGSonqw%3D%3D%0A&m=%2B%2Bkxr1kNzm83C5RPkRlha1d0eUWXp7eVGgXWS%2F0MCDk%3D%0A&s=0cedb0184fc7b6271a3c209b247d747a6fe6d472e45329ba4b00fec538753bf4" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=8am7JZUn9ir%2BIPWQGSonqw%3D%3D%0A&m=%2B%2Bkxr1kNzm83C5RPkRlha1d0eUWXp7eVGgXWS%2F0MCDk%3D%0A&s=218b66c9dbe88e4a2ec30bfbe22cf49fa5e5dfe6b5e774878f4782d056fc2c90" target="_blank">
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
</p>
</div>
</div>
</span>
</div></div></div>

</blockquote></div><br></div></div>