<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 22, 2016 at 12:07 PM, Mehdi AMINI via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">mehdi_amini added inline comments.<br>
<br>
================<br>
Comment at: lib/Transforms/Scalar/ADCE.<wbr>cpp:459<br>
@@ -395,2 +458,3 @@<br>
   void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
-    AU.setPreservesCFG();<br>
+    AU.addRequired<<wbr>PostDominatorTreeWrapperPass>(<wbr>);<br>
+    AU.setPreservesCFG(); // TODO -- will remove when we start removing branches<br>
----------------<br>
How expensive is this?<br></blockquote><div><br></div><div><br></div><div>FWIW: On very large testcases that take many many seconds, postdom usually costs <1 second.</div><div><br></div><div>The real cost is if we use it in a lot of places without an update scheme, such that it gets invalidated a lot.</div><div><br></div><div>I mentioned this privately to a few folks, but i actually have such an update scheme -</div><div>There are recent advances in incremental dominator tree algorithms that make it so we can update postdom under random edge addition and deletion very quickly, and in most cases, at least 50-100x faster than we can rebuild it.</div><div>The only thing required is to tell it what CFG edges you added/removed.</div><div><br></div><div>It's based on the algorithms in <a href="http://arxiv.org/pdf/1604.02711v1.pdf">http://arxiv.org/pdf/1604.02711v1.pdf</a> (I have the code from the paper, and hacked it into llvm for testing purposes :P)</div><div><br></div><div>note: the timings here are for complete incremental update after each change. If you batch changes, it is at least an order of magnitude cheaper.</div><div><br></div><div>Insertion is very cheap, it's deletion that can be expensive.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>