[LLVMdev] Program Slicing using LLVM?

Dan Gohman gohman at apple.com
Tue Feb 26 11:15:23 PST 2008


On Feb 26, 2008, at 1:37 AM, Prabhat Kumar Saraswat wrote:
>
> Has someone already worked on this, or are there similar components i
> can reuse in my work?
>
>
> I am planning to create a IntraProcedure Dependence Graph (PDG) and
> then traverse along it to identify the relevant parts of the program.
> Any ideas?

LLVM has analysis passes that compute post-dominator information, on
which a PDG construction algorithm could be built.  I know of two  
specific
things to be aware of in this area.  First, if the program has any
infinite loops using unconditional branches, they won't be post- 
dominated
by any exit node.  If this is a problem for you, you may have to do some
extra work to handle it.  Second, programs with multiple return  
statements
aren't handled correctly; see PR1098. This can be worked around by
using the mergereturn pass.

Dan




More information about the llvm-dev mailing list