[llvm] [InstSimplify] Fix Compilation Hang in simplifyExtractValueInst (PR #190279)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 5 12:49:23 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)
----------------
nikic wrote:
This will only handle a trivial cycle, but it can also be cyclic across multiple insertvalue instructions. You need either a visited set or a depth limit.
https://github.com/llvm/llvm-project/pull/190279
More information about the llvm-commits
mailing list