When you think this fixes bug 11235 and all test cases that are more complex than that, why not?<br><br><div class="gmail_quote">2011/12/5 Devang Patel <span dir="ltr"><<a href="mailto:dpatel@apple.com">dpatel@apple.com</a>></span><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"><div><div></div><div class="h5"><br><div><div>On Dec 2, 2011, at 11:56 AM, Carl-Philip Hänsch wrote:</div>
<br><blockquote type="cite">While trying to find a solution for this bug <a href="http://llvm.org/bugs/show_bug.cgi?id=11235" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=11235</a> ,<br>I came to the conclusion that the following things can happen while optimizing:<br>
- after gvn, I get new constants which are inserted into br and add/sum/..., so there should be at least one more jump-threading and/or instsimplify<br> - after instsimplify, I get new constants which are inserted into br, so there should be one more jump-threading pass<br>
- after jump-threading, new bigger blocks occur with redundant loads which need an other gvn pass<br><br>At least for -O3 we will need those optimizations.<br>Is there a kind of "I need at least one more $XYZ pass" call that can be invoked from a Pass?<br>
<br>So my suggestion to implement in LLVM is:<br> - Detect where exactly constants are inserted<br> - Detect which pass is responsible to continue folding it<br> - Insert that pass if allowed and if it is not in the queue by a ProposePass function<br>
<br>ProposePass should decide wether it's worth to further constant fold the block by running the proposed pass. Once accepted, the pass should be inserted into the pass queue at a position where it is most effective.<br>
<br>What do you think about that idea? How much would be the effort of implementing it? Does it fit the layering design?<br></blockquote><br></div></div></div><div>This looks like a slippery slope towards finding optimal optimization pass sequence. </div>
<div><br></div><div>Why not fix pass sequence manually by updating PassManagerBuilder directly ? </div><div>-</div><div>Devang</div><font color="#888888"><br></font></div></blockquote></div><br>