There is no need to create preheaders in the analysis stage, we only
need them when adjusting the branches. Also, the only cases we need to
create our own preheaders is when they have more than 1 predecessors or
PHI nodes (even with only 1 predecessor, we could have an LCSSA phi
node). I have simplified the conditions and added some assertions to be
sure. Because we know the inner and outer loop need to be tightly
nested, it is sufficient to check if the inner loop preheader is the
outer loop header to check if we need to create a new preheader.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM
lib/Transforms/Scalar/LoopInterchange.cpp | ||
---|---|---|
1350 ↗ | (On Diff #164098) | Please add a comment explaining that this is using InsertPreheaderForLoop to insert an "extra" preheader block for loops which already have a preheader. |