[LLVMdev] Live values detection in LLVM

Julien Henry Julien.Henry at imag.fr
Fri Feb 25 00:41:36 PST 2011


Hi all,


At some points of my program, I would like to know if some LLVM values 
are live or not. For that, I'm using the LiveValues pass, which gives me 
methods such as :

isLiveThroughBlock(Value * v, BasicBlock * b)
isKilledInBlock(Value * v, BasicBlock * b)


* If I understand well the code, dominator trees are used to compute the 
LiveThrough blocks.
The definition of dominator in graph theory is the following:
"A node <http://en.wikipedia.org/wiki/Node_%28computer_science%29> d 
/dominates/ a node n if every path from the /start node/ to n must go 
through d."

Then, that means in some cases, the method isLiveThroughBlock is going 
to answer false, whereas the right answer is true. Is it right ?

* To compute the set of blocks where isKilledInBlock is true, we compute 
the smallest loop containing both the definition of the variable and all 
its use, and isKilledInBlock becomes true in all ExitingBlock of this loop.
An exiting block is a block inside the loop that have successors outside 
of the loop.
So, even if isKilledInBlock(v,b)=true, that doesn't mean the value can't 
be used anymore: if the exiting block has a successor in the loop, then 
the value will be used again.


Do I understand well ? If yes, how is it possible to say for sure that a 
value isn't used any more ?

Thanks for your help

J. Henry



More information about the llvm-dev mailing list