[llvm] [LVI] Merge ranges reliably and precisely (PR #173714)

Kunqiu Chen via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 27 06:39:51 PST 2025


================
@@ -794,26 +810,28 @@ LazyValueInfoImpl::solveBlockValuePHINode(PHINode *PN, BasicBlock *BB) {
       // 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});
   }
 
+  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