<div dir="ltr"><div dir="ltr">On Thu, Feb 20, 2020 at 1:10 PM Vedant Kumar <<a href="mailto:vedant_kumar@apple.com">vedant_kumar@apple.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Wdyt of having DominatorTree take advantage of the instruction ordering? Istm this is needed to allow various clients in llvm to get rid of special handling for block-local queries.<br>
<br>
--- a/llvm/lib/IR/Dominators.cpp<br>
+++ b/llvm/lib/IR/Dominators.cpp<br>
@@ -138,16 +138,11 @@ bool DominatorTree::dominates(const Instruction *Def,<br>
     return dominates(Def, UseBB);<br>
<br>
   if (DefBB != UseBB)<br>
     return dominates(DefBB, UseBB);<br>
<br>
-  // Loop through the basic block until we find Def or User.<br>
-  BasicBlock::const_iterator I = DefBB->begin();<br>
-  for (; &*I != Def && &*I != User; ++I)<br>
-    /*empty*/;<br>
-<br>
-  return &*I == Def;<br>
+  return Def->comesBefore(User);<br>
 }<br></blockquote><div><br></div><div> Absolutely! That was the idea, truly I just rebased the old work and didn't realize this wasn't hooked up.</div></div></div>