We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4746a9 commit 6918d2cCopy full SHA for 6918d2c
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1809,6 +1809,12 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
1809
for (PHINode *PN : Cleanup)
1810
RecursivelyDeleteDeadPHINode(PN);
1811
1812
+ // LoopDeletion only delete invariant loops with known trip-count. We can
1813
+ // update the condition so it will reliablely delete the invariant loop
1814
+ assert(LoopTerm->getNumSuccessors() == 2 &&
1815
+ (LoopTerm->getSuccessor(0) == LoopBody ||
1816
+ LoopTerm->getSuccessor(1) == LoopBody) &&
1817
+ "loop body must have a successor that is it self");
1818
ConstantInt *NewLoopCond = LoopTerm->getSuccessor(0) == LoopBody
1819
? Builder.getFalse()
1820
: Builder.getTrue();
0 commit comments