[llvm] [LoopSplitUtils] Prevent erasure of non-dead latch compares (PR #214243)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 00:08:23 PDT 2026


================
@@ -518,8 +529,7 @@ static void rewriteLatch(Loop *PL, Value *IndOp, Value *SelEnd,
         /*IsExpected=*/false);
   }
   Term->eraseFromParent();
-  if (Cmp->use_empty())
-    Cmp->eraseFromParent();
+  return Cmp->use_empty() ? Cmp : nullptr;
----------------
artagnon wrote:

Isn't this technically an "escaping value" that should be handled in collectEscapingValues?

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


More information about the llvm-commits mailing list