[LLVMdev] CFG using LLVM

Eli Friedman eli.friedman at gmail.com
Sat Nov 14 09:44:14 PST 2009


On Sat, Nov 14, 2009 at 7:02 AM, Hersh.S. Iyer <coolhersh at gmail.com> wrote:
> Now, I wish to perform a few optimizations to the code starting with dead
> code elimination.
> For this I would need the CFG. I am very new to all of this stuff. Please
> help me out guys.
> The way I want to proceed is to start at the top of the CFG and then find
> out the blocks
> reachable from here. At the end, if any basic block remains unreachable,
> then I would
> classify it as dead code.

I think the function RemoveUnreachableBlocksFromFn in
lib/Transforms/Scalar/SimplifyCFGPass.cpp does the transformation
you're describing.

-Eli



More information about the llvm-dev mailing list