[llvm] [ValueLattice][SCCP] Consider provenance for predicate-derived pointer constants (PR #160083)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 5 00:43:36 PDT 2026


================
@@ -57,6 +58,14 @@ bool SCCPSolver::isConstant(const ValueLatticeElement &LV) {
          (LV.isConstantRange() && LV.getConstantRange().isSingleElement());
 }
 
+bool SCCPSolver::isReplaceableConstant(const ValueLatticeElement &LV) {
+  if (!isConstant(LV))
+    return false;
+  if (LV.mayHaveDifferentProvenance())
+    return false;
+  return true;
----------------
nikic wrote:

```suggestion
  return isConstant(LV) && !LV.mayHaveDifferentProvenance();
```

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


More information about the llvm-commits mailing list