Do not insert a new block, if it could transform a loop into an irreducible loop.
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Another option here would be to make SimplifyCFG insert a preheader for loops which don't have one. That seems better in terms of canonicalization.
Comment Actions
Err, nevermind... I somehow thought we were preserving preheaders already in SimplifyCFG, but I guess we aren't.
I'll think about this a bit more.
Comment Actions
Added some code review comments.
At a higher level, we should consider changing SimplifyCFG so it doesn't fight LoopSimplify over the canonical form of a loop... but just fixing the bug is fine for now.
lib/Transforms/Utils/SimplifyCFG.cpp | ||
---|---|---|
172 | Do we need to do any additional work to keep this map up-to-date? The predecessors of the loop header could get folded. | |
1800 | BBEnd instead of BI1->getSuccessor(0)? | |
1802 | *irreducible |
Do we need to do any additional work to keep this map up-to-date? The predecessors of the loop header could get folded.