[LLVMdev] SimplifyCFG vs loops

Krzysztof Parzyszek kparzysz at codeaurora.org
Wed Oct 17 08:41:05 PDT 2012

Hello All,

The current implementation of the CFG simplification is loop-agnostic. 
In the past I have observed that it can perform transformations that can 
be detrimental to the loop structure.  One example that I recall, is 
converting a loop like this:
    while (...) {
       if (cond) continue;
into two nested loops.  Specifically, the "continue" branch would go 
back to the loop header making it appear as if there were two back edges.

What are your thoughts about either making the CFG simplification aware 
of loops in its entirety, or separating the "safe" transformations in a 
quick pass, and having a more aggressive pass that does preserve loop 


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation

More information about the llvm-dev mailing list