[LLVMdev] How to know if an instruction is "usable"

Giacomo Tagliabue giacomo.tag at gmail.com
Thu Apr 25 10:21:03 PDT 2013

Thanks! I checked that module. If I use dominates(const Instruction
*Def,const Instruction *User) it will automatically check everything, so I
don't have to handle the case with instructions in the same BB, right?

On 25 April 2013 12:17, Krzysztof Parzyszek <kparzysz at codeaurora.org> wrote:

> On 4/25/2013 12:06 PM, Giacomo Tagliabue wrote:
>> Thanks,
>> So, how do I check if a block dominates another one?
> In IR use analysis DominatorTree from "include/llvm/Analysis/**Dominators.h".
>  For machine instructions, use MachineDominatorTree
> from "include/llvm/CodeGen/**MachineDominators.h".
> 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.
> -Krzysztof
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by The Linux Foundation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130425/0fa3d99d/attachment.html>

More information about the llvm-dev mailing list