[LLVMdev] Irreducibility and the -simplifycfg flag

James Stanier j.stanier at sussex.ac.uk
Tue Jun 30 04:22:45 PDT 2009

Hi everyone,

I'm currently trying to run a study on irreducibility of C programs, and
I've implemented structural analysis (original paper by Sharir, algorithm in
Muchnick's book) as an LLVM pass. When my implementation becomes a bit less
buggy I'll certainly look into including it in the LLVM project. 

As a test for the algorithm I've been producing LLVM bitcode for C files in
the GNU coreutils package. When generating bitcode, I find that sometimes
the CFG produced can have basic blocks that have no successors or
predecessors; using "-view-cfg-only" they just float around on their own,
unconnected to anything in the dot file. This causes upset in the algorithm
at the moment, so I was overcoming the problem by running "-simplify-cfg"
before structural analysis takes place.

My question is this: would the simplify pass ever make a reducible CFG
become irreducible? My current inkling is towards no from what I can see in
the source code and the documentation. However I was wondering if someone
with more experience and understanding of the pass could share some wisdom!
If it does, is there a simpler "clean-up" pass that I could run?

Best wishes,
View this message in context: http://www.nabble.com/Irreducibility-and-the--simplifycfg-flag-tp24270165p24270165.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.

More information about the llvm-dev mailing list