[llvm] [LoopIdiom] Update strlen idiom body loop condition to be clean up by LoopDeletion (PR #134906)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 05:02:47 PDT 2025


================
@@ -1804,6 +1808,11 @@ bool LoopIdiomRecognize::recognizeAndInsertStrLen() {
   // up by later passes
   for (PHINode *PN : Cleanup)
     RecursivelyDeleteDeadPHINode(PN);
+
+  ConstantInt *NewLoopCond = LoopTerm->getSuccessor(0) == LoopBody
----------------
Meinersbur wrote:

Consider adding a comment explaining that this intends to make the old code unreachable/dead.

Add `assert` that at least one of the successors is `LoopBody`?

https://github.com/llvm/llvm-project/pull/134906


More information about the llvm-commits mailing list