[PATCH] D70939: [LoopUtils] Updated deleteDeadLoop() to handle loop nest.
Whitney Tsang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 16 17:12:37 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc066ff11d84a: [LoopUtils] Updated deleteDeadLoop() to handle loop nest. (authored by Whitney).
Changed prior to commit:
https://reviews.llvm.org/D70939?vs=233162&id=234197#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70939/new/
https://reviews.llvm.org/D70939
Files:
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/unittests/Transforms/Utils/CMakeLists.txt
Index: llvm/unittests/Transforms/Utils/CMakeLists.txt
===================================================================
--- llvm/unittests/Transforms/Utils/CMakeLists.txt
+++ llvm/unittests/Transforms/Utils/CMakeLists.txt
@@ -15,6 +15,7 @@
FunctionComparatorTest.cpp
IntegerDivisionTest.cpp
LocalTest.cpp
+ LoopUtilsTest.cpp
SizeOptsTest.cpp
SSAUpdaterBulkTest.cpp
UnrollLoopTest.cpp
Index: llvm/lib/Transforms/Utils/LoopUtils.cpp
===================================================================
--- llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -673,7 +673,18 @@
LI->removeBlock(BB);
// The last step is to update LoopInfo now that we've eliminated this loop.
- LI->erase(L);
+ // Note: LoopInfo::erase remove the given loop and relink its subloops with
+ // its parent. While removeLoop/removeChildLoop remove the given loop but
+ // not relink its subloops, which is what we want.
+ if (Loop *ParentLoop = L->getParentLoop()) {
+ Loop::iterator I = find(ParentLoop->begin(), ParentLoop->end(), L);
+ assert(I != ParentLoop->end() && "Couldn't find loop");
+ ParentLoop->removeChildLoop(I);
+ } else {
+ Loop::iterator I = find(LI->begin(), LI->end(), L);
+ assert(I != LI->end() && "Couldn't find loop");
+ LI->removeLoop(I);
+ }
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70939.234197.patch
Type: text/x-patch
Size: 1373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191217/5089ea2d/attachment.bin>
More information about the llvm-commits
mailing list