[LLVMdev] Question about use-def chain

Chris Lattner sabre at nondot.org
Wed Mar 12 09:45:22 PDT 2008


On Mar 12, 2008, at 12:22 AM, 신건철 wrote:

> Programmers’ manual says we can  
> iterate over a use-def chain by op_iterator.
> It works fine except for load and store instruction of stack  
> variables.
>
> For example, a simple bitcode is like the below.
> i = alloca i32
> store i32 0, i32* %i, align 4
> %tmp1 = load i32* %i, align 4
>
> If I apply a use-def chain to load instruction, I get alloca  
> instruction.
> I think store instruction is a correct use-def chain.
> Am I right?
> Is there any other method to iterate over a use-def chain in this  
> case?

You should try out Owen's MemDepAnalysis interface, which returns the  
load/store that another load/store depends on.  Note that this is a  
fuzzy query: it depends on the precision of alias analysis.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080312/87e8af6f/attachment.html>


More information about the llvm-dev mailing list