LoopInterchange relies on LoopInfo being up-to-date, so we should
preserve it after interchanging. This patch updates restructureLoops to
move the BBs of the interchanged loops to the right place.
Details
Diff Detail
Event Timeline
Can you add verify-loop-info to all the LoopInterchange tests?
lib/Transforms/Scalar/LoopInterchange.cpp | ||
---|---|---|
1190 | changeLoopFor works correctly even if OuterLoopParent is null, so the "if" isn't necessary. | |
1243 | This looks weird; you're removing the block from the outer loop, but it's still in the inner loop? |
Thanks Eli! I added -verify-loop-info to all tests. I also renamed the parameters of restructureLoops to NewInner and NewOuter, which makes things slightly clearer, I hope.
lib/Transforms/Scalar/LoopInterchange.cpp | ||
---|---|---|
1243 | In this version, the variable OuterLoop refers to the original outer loop, which becomes the inner loop and InnerLoop refers to the loop that becomes the outer loop. I have renamed the variables to NewInner and NewOuter. Do you think it's clearer now? |
changeLoopFor works correctly even if OuterLoopParent is null, so the "if" isn't necessary.