[llvm] [SCEV] Return a SCEVUse from getAddExpr and propagate use flags. (PR #220007)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 06:01:49 PDT 2026


================
@@ -2564,6 +2545,15 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<SCEVUse> &Ops,
   if (Folded)
     return Folded;
 
+  // Conservatively drop use-specific flags if operands changed after constant
+  // folding, i.e. we are building a different expression than the initial one,
+  // for which the use-specific flags hold.
+  // TODO: In some cases, this is overly conservative.
----------------
fhahn wrote:

Yep, I was unnecessary conservative here, updated to keep use-specific flags in the presence of constant folding, thanks!

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


More information about the llvm-commits mailing list