[LLVMdev] Irreducibility and the -simplifycfg flag

Eli Friedman eli.friedman at gmail.com
Tue Jun 30 05:33:03 PDT 2009

On Tue, Jun 30, 2009 at 4:22 AM, James Stanier<j.stanier at sussex.ac.uk> wrote:
> My question is this: would the simplify pass ever make a reducible CFG
> become irreducible?

If it does, it's a bug; transforming a reducible CFG into an
irreducible CFG significantly pessimizes the loop analysis passes.
That said, I'm pretty sure it can in some unusual cases. If you care,
a patch to split out the RemoveUnreachableBlocksFromFn helper from
SimplifyCFGPass into a helper available from
llvm/Transforms/Utils/Local.h would be welcome, I think.

That said, it's pretty easy to dodge the issue in your pass by
iterating over the tree of BBs with df_begin/df_end rather than the
list of BBs for the function; see llvm/ADT/DepthFirstIterator.h.


More information about the llvm-dev mailing list