<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Erm, nevermind.  I had it backwards in my head.  Sorry for the noise!<div><br></div><div>--Owen</div><div><br><div><div>On Oct 31, 2009, at 11:35 PM, Owen Anderson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Chris,<div><br><div><div>On Oct 31, 2009, at 3:11 PM, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: lattner<br>Date: Sat Oct 31 17:11:15 2009<br>New Revision: 85692<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=85692&view=rev">http://llvm.org/viewvc/llvm-project?rev=85692&view=rev</a><br>Log:<br>Make sure PRE doesn't split crit edges from indirectbr.<br><br>Modified:<br>    llvm/trunk/lib/Transforms/Scalar/GVN.cpp<br><br>Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=85692&r1=85691&r2=85692&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=85692&r1=85691&r2=85692&view=diff</a><br><br>==============================================================================<br>--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)<br>+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Sat Oct 31 17:11:15 2009<br>@@ -1810,7 +1810,7 @@<br><br> /// performPRE - Perform a purely local form of PRE that looks for diamond<br> /// control flow patterns and attempts to perform simple PRE at the join point.<br>-bool GVN::performPRE(Function& F) {<br>+bool GVN::performPRE(Function &F) {<br>   bool Changed = false;<br>   SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit;<br>   DenseMap<BasicBlock*, Value*> predMap;<br>@@ -1875,6 +1875,10 @@<br>       // we would need to insert instructions in more than one pred.<br>       if (NumWithout != 1 || NumWith == 0)<br>         continue;<br>+      <br>+      // Don't do PRE across indirect branch.<br>+      if (isa<IndirectBrInst>(PREPred->getTerminator()))<br>+        continue;<br><br>       // We can't do PRE safely on a critical edge, so instead we schedule<br>       // the edge to be split and perform the PRE the next time we iterate<br><br></div></blockquote></div><br></div><div>This isn't correct.  PREPred is the block in which the expression is already computed, so it never needs to split that edge.  What you need to check is that none of the <i>other</i> predecessors is via an indirect branch, as PRE would possibly need to split those edges to insert instructions.</div><div><br></div><div>--Owen</div></div>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></div></body></html>