[llvm] [InstSimplify] Fix Compilation Hang in simplifyExtractValueInst (PR #190279)

Sharjeel Khan via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 14:40:47 PDT 2026


================
@@ -5466,6 +5465,14 @@ static Value *simplifyExtractValueInst(Value *Agg, ArrayRef<unsigned> Idxs,
         return IVI->getInsertedValueOperand();
       break;
     }
+
+    // Based on the verifier, self-referential insertvalues are apparently
+    // fine in unreachable blocks and they will cause this loop to run
+    // infinitely. I am just adding a check to break out if it is the case.
+    auto *NewIVI = dyn_cast<InsertValueInst>(IVI->getAggregateOperand());
+    if (IVI == NewIVI)
----------------
Sharjeel-Khan wrote:

Changed it to use a visitedSet and added a testcase for cyclic across multiple insertvalue instructions

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


More information about the llvm-commits mailing list