[llvm] [LVI] Merge ranges stably and precisely (PR #173714)
Kunqiu Chen via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 27 03:14:29 PST 2025
================
@@ -793,27 +796,34 @@ LazyValueInfoImpl::solveBlockValuePHINode(PHINode *PN, BasicBlock *BB) {
if (!EdgeResult)
// Explore that input, then return here
return std::nullopt;
-
- Result.mergeIn(*EdgeResult);
-
- // If we hit overdefined, exit early. The BlockVals entry is already set
- // to overdefined.
- if (Result.isOverdefined()) {
- LLVM_DEBUG(dbgs() << " compute BB '" << BB->getName()
- << "' - overdefined because of pred (local).\n");
-
- return Result;
- }
+ IncomingIVs.push_back(*EdgeResult);
+ if (EdgeResult->isOverdefined())
+ break;
if (PerPredRanges)
PredLatticeElements->insert({PhiBB, *EdgeResult});
}
+ // for (auto &IV : IncomingIVs) {
+ // errs() << "Before merge: " << Result << "\n";
+ // errs() << "\tmerge IV: " << IV << "\n";
+ // Result.mergeIn(IV);
+ // errs() << "After merge: " << Result << "\n-------\n";
+ // }
+ Result.mergeIn(IncomingIVs);
----------------
Camsyn wrote:
Is it necessary to manage to extend this change to SCCP as well?
The monotonicity of the merge function is a sufficient, but not a necessary, condition for convergence of fixpoint iteration.
https://github.com/llvm/llvm-project/pull/173714
More information about the llvm-commits
mailing list