If a loop with child loops becomes our new inner loop after
interchanging, we only need to update LoopInfo for the blocks defined in
the old outer loop. BBs in child loops will stay there.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
LoopInterchange did that wrong and this additional assertion catches that. The fix for LoopInterchange is at D45970
Needs testcase.
LoopInterchange did that wrong and this additional assertion catches that. The fix for LoopInterchange is at D45970
Did you mean to post this on a different patch?
tests/Transform/LoopInterchange/phi-ordering.ll has a loop nest with 3 levels deep that gets interchanged twice and exposes the problem. With D45971, -verify-loop-info on the test case should fail (and I think there is another test case that also fails with D45971). I am happy to add a separate test case, in case you think that's valuable.
LoopInterchange did that wrong and this additional assertion catches that. The fix for LoopInterchange is at D45970
Did you mean to post this on a different patch?
Yes, I meant to post this on D45971...
LGTM
I'm not really happy with LoopInterchangeTransform::restructureLoops overall; it seems like complicated, fragile code. But I don't see a better alternative.
Thanks Eli. It is not ideal.... Maybe there's potential for a more generic API to update LoopInfo, but the things we need to update here seem quite specific to interchanging.