<div dir="ltr"><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif;font-size:small">Thanks! I checked that module. If I use </span><font face="courier new, monospace">dominates(const Instruction *Def,const Instruction *User) </font><font face="arial, helvetica, sans-serif">it will automatically check everything, so I don't have to handle the case with instructions in the same BB, right?</font></div>

<div class="gmail_default" style><font face="arial, helvetica, sans-serif">Thanks,<br>GT</font></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 25 April 2013 12:17, Krzysztof Parzyszek <span dir="ltr"><<a href="mailto:kparzysz@codeaurora.org" target="_blank">kparzysz@codeaurora.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 4/25/2013 12:06 PM, Giacomo Tagliabue wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks,<br>
So, how do I check if a block dominates another one?<br>
</blockquote>
<br></div>
In IR use analysis DominatorTree from "include/llvm/Analysis/<u></u>Dominators.h".  For machine instructions, use MachineDominatorTree<br>
from "include/llvm/CodeGen/<u></u>MachineDominators.h".<br>
<br>
Both of them implement function "dominates" that takes two blocks (BasicBlock* or MachineBasicBlock*) and returns a boolean value indicating whether one dominates the other.  A block will always dominate itself, so this case needs to be handled separately to determine relative position between the def and the use instruction.<div class="HOEnZb">

<div class="h5"><br>
<br>
-Krzysztof<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<br>
</div></div></blockquote></div><br></div></div>