[LLVMdev] Last use of operand within BasicBlock?

ryan baird ryanrbaird at gmail.com
Mon Jul 16 12:16:33 PDT 2012


Given an instruction and the basic block that it's in, is there an easy way
to tell if the operands are ever referenced after the instruction?

For example, if i have
...
%mul = mul nsw i32 %a, %val
%add = add nsw i32 %b, %val
...

And I'm iterating through this basic block, can I tell when I get to the
multiply instruction that another instruction is going to be using %val?

Since I'm running my code through reg2mem, I don't really care much about
other basicblocks (anything outside the basicblock should have an
eliminated phi instruction so it will be pulled from memory anyways).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120716/8ea31fd2/attachment.html>


More information about the llvm-dev mailing list