<div dir="ltr">It does with ASan IIRC. THere is a thread about this on the mailing list where Alexey reported the bug.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 2, 2013 at 1:31 AM, Duncan Sands <span dir="ltr"><<a href="mailto:duncan.sands@gmail.com" target="_blank">duncan.sands@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alexey,<div class="im"><br>
<br>
On 02/08/13 10:06, Alexey Samsonov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: samsonov<br>
Date: Fri Aug  2 03:06:43 2013<br>
New Revision: 187646<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=187646&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=187646&view=rev</a><br>
Log:<br>
Fix dereferencing end iterator in SimplifyCFG. Patch by Ye Mei.<br>
</blockquote>
<br></div>
does this bug fire on some testcases that are already in the regression test<br>
suite (for example if built with expensive checks enabled)?<br>
<br>
Ciao, Duncan.<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
     llvm/trunk/lib/Transforms/<u></u>Utils/SimplifyCFG.cpp<br>
<br>
Modified: llvm/trunk/lib/Transforms/<u></u>Utils/SimplifyCFG.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=187646&r1=187645&r2=187646&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>Transforms/Utils/SimplifyCFG.<u></u>cpp?rev=187646&r1=187645&r2=<u></u>187646&view=diff</a><br>

==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/Transforms/<u></u>Utils/SimplifyCFG.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<u></u>Utils/SimplifyCFG.cpp Fri Aug  2 03:06:43 2013<br>
@@ -4290,7 +4290,8 @@ bool SimplifyCFGOpt::<u></u>SimplifyParallelAnd<br>
    // Do the transformation.<br>
    BasicBlock *CB;<br>
    bool Iteration = true;<br>
-  BasicBlock::iterator ItOld = Builder.GetInsertPoint();<br>
+  BasicBlock *SaveInsertBB = Builder.GetInsertBlock();<br>
+  BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint();<br>
    BranchInst *PBI = dyn_cast<BranchInst>(<u></u>FirstCondBlock->getTerminator(<u></u>));<br>
    Value *PC = PBI->getCondition();<br>
    do {<br>
@@ -4319,8 +4320,8 @@ bool SimplifyCFGOpt::<u></u>SimplifyParallelAnd<br>
      // make CB unreachable and let downstream to delete the block.<br>
      new UnreachableInst(CB-><u></u>getContext(), CB);<br>
    } while (Iteration);<br>
-<br>
-  Builder.SetInsertPoint(ItOld);<br>
+  if (SaveInsertBB)<br>
+    Builder.SetInsertPoint(<u></u>SaveInsertBB, SaveInsertPt);<br>
    DEBUG(dbgs() << "Use parallel and/or in:\n" << *FirstCondBlock);<br>
    return true;<br>
  }<br>
@@ -4454,11 +4455,13 @@ bool SimplifyCFGOpt::MergeIfRegion(<u></u>Basic<br>
    FirstEntryBlock->getInstList()<u></u>.splice(FirstEntryBlock->end()<u></u>, SecondEntryBlock->getInstList(<u></u>));<br>
    BranchInst *PBI = dyn_cast<BranchInst>(<u></u>FirstEntryBlock-><u></u>getTerminator());<br>
    Value *CC = PBI->getCondition();<br>
-  BasicBlock::iterator ItOld = Builder.GetInsertPoint();<br>
+  BasicBlock *SaveInsertBB = Builder.GetInsertBlock();<br>
+  BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint();<br>
    Builder.SetInsertPoint(PBI);<br>
    Value *NC = Builder.CreateOr(CInst1, CC);<br>
    PBI->replaceUsesOfWith(CC, NC);<br>
-  Builder.SetInsertPoint(ItOld);<br>
+  if (SaveInsertBB)<br>
+    Builder.SetInsertPoint(<u></u>SaveInsertBB, SaveInsertPt);<br>
<br>
    // Remove IfTrue1<br>
    if (IfTrue1 != FirstEntryBlock) {<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">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/<u></u>mailman/listinfo/llvm-commits</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">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/<u></u>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>