[llvm] r330653 - [LoopInterchange] Do not change LI for BBs in child loops.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 23 14:38:19 PDT 2018
Author: fhahn
Date: Mon Apr 23 14:38:19 2018
New Revision: 330653
URL: http://llvm.org/viewvc/llvm-project?rev=330653&view=rev
Log:
[LoopInterchange] Do not change LI for BBs in child loops.
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.
Reviewers: efriedma, karthikthecool, mcrosier
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D45970
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp?rev=330653&r1=330652&r2=330653&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp Mon Apr 23 14:38:19 2018
@@ -1220,6 +1220,9 @@ void LoopInterchangeTransform::restructu
BasicBlock *OuterHeader = NewOuter->getHeader();
BasicBlock *OuterLatch = NewOuter->getLoopLatch();
for (BasicBlock *BB : OrigInnerBBs) {
+ // Nothing will change for BBs in child loops.
+ if (LI->getLoopFor(BB) != NewOuter)
+ continue;
// Remove the new outer loop header and latch from the new inner loop.
if (BB == OuterHeader || BB == OuterLatch)
NewInner->removeBlockFromLoop(BB);
More information about the llvm-commits
mailing list