[llvm] [VectorCombine] Avoid crash when the next node is deleted. (PR #155115)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 23 13:45:31 PDT 2025


================
@@ -4254,13 +4260,18 @@ bool VectorCombine::run() {
     if (!DT.isReachableFromEntry(&BB))
       continue;
     // Use early increment range so that we can erase instructions in loop.
-    for (Instruction &I : make_early_inc_range(BB)) {
-      if (I.isDebugOrPseudoInst())
-        continue;
-      MadeChange |= FoldInst(I);
+    Instruction *I = &BB.front();
----------------
antoniofrighetto wrote:

Might as well update comment above w/ manually resetting the iterator if gets invalidated?

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


More information about the llvm-commits mailing list