<div class="gmail_quote">On 15 August 2011 21:52, Bill Wendling <span dir="ltr"><<a href="mailto:isanbard@gmail.com">isanbard@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Author: void<br>
Date: Mon Aug 15 23:52:55 2011<br>
New Revision: 137712<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=137712&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=137712&view=rev</a><br>
Log:<br>
A few places where we want to skip the landingpad instruction for insertion.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp<br>
    llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br>
    llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp<br>
<br>
Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=137712&r1=137711&r2=137712&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=137712&r1=137711&r2=137712&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)<br>
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Mon Aug 15 23:52:55 2011<br>
@@ -1323,8 +1323,11 @@<br>
       // If the SCEV is computable at this level, insert it into the header<br>
       // after the PHIs (and after any other instructions that we've inserted<br>
       // there) so that it is guaranteed to dominate any user inside the loop.<br>
-      if (L && SE.hasComputableLoopEvolution(S, L) && !PostIncLoops.count(L))<br>
+      if (L && SE.hasComputableLoopEvolution(S, L) && !PostIncLoops.count(L)) {<br>
         InsertPt = L->getHeader()->getFirstNonPHI();<br>
+        if (isa<LandingPadInst>(InsertPt))<br>
+          InsertPt = llvm::next(BasicBlock::iterator(InsertPt));<br>
+      }<br>
       while (isInsertedInstruction(InsertPt) || isa<DbgInfoIntrinsic>(InsertPt))<br>
         InsertPt = llvm::next(BasicBlock::iterator(InsertPt));<br>
       break;<br>
<br>
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=137712&r1=137711&r2=137712&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=137712&r1=137711&r2=137712&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Mon Aug 15 23:52:55 2011<br>
@@ -601,6 +601,7 @@<br>
   // Advance to a place where it is safe to insert the new store and<br>
   // insert it.<br>
   BBI = DestBB->getFirstNonPHI();<br>
+  if (isa<LandingPadInst>(BBI)) ++BBI;<br>
   StoreInst *NewSI = new StoreInst(MergedVal, SI.getOperand(1),<br>
                                    SI.isVolatile(),<br>
                                    SI.getAlignment(),<br>
<br>
Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=137712&r1=137711&r2=137712&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=137712&r1=137711&r2=137712&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Mon Aug 15 23:52:55 2011<br>
@@ -505,7 +505,9 @@<br>
       }<br>
       for (int i = 0, e = ComplexEdgeSuccs.size(); i != e; ++i) {<br>
         // call runtime to perform increment<br>
-        IRBuilder<> Builder(ComplexEdgeSuccs[i+1]->getFirstNonPHI());<br>
+        BasicBlock::iterator InsertPt = ComplexEdgeSuccs[i+1]->getFirstNonPHI();<br>
+        if (isa<LandingPadInst>(InsertPt)) ++InsertPt;<br>
+        IRBuilder<> Builder(InsertPt);<br></blockquote><div><br></div><div>How about a method like getFirstNonPHI() but that skips landingpad called getFirstInsertPoint? The comment for such a method would be that it returns the earliest insertpt that does not have an ordering constraint in the IR?</div>

<div><br></div><div>Nick</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
         Value *CounterPtrArray =<br>
             Builder.CreateConstInBoundsGEP2_64(EdgeTable, 0,<br>
                                                i * ComplexEdgePreds.size());<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>