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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 07:57:08 PDT 2026


================
@@ -750,20 +750,23 @@ class ScalarEvolution {
   LLVM_ABI const SCEV *getCastExpr(SCEVTypes Kind, SCEVUse Op, Type *Ty);
   LLVM_ABI const SCEV *getAnyExtendExpr(SCEVUse Op, Type *Ty);
 
-  LLVM_ABI const SCEV *getAddExpr(SmallVectorImpl<SCEVUse> &Ops,
-                                  SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
-                                  unsigned Depth = 0);
-  const SCEV *getAddExpr(SCEVUse LHS, SCEVUse RHS,
-                         SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
-                         unsigned Depth = 0) {
+  LLVM_ABI SCEVUse getAddExpr(SmallVectorImpl<SCEVUse> &Ops,
+                              SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
+                              unsigned Depth = 0,
+                              SCEV::NoWrapFlags UseFlags = SCEV::FlagAnyWrap);
----------------
nikic wrote:

These two nowrap flag arguments (with a depth in between...) look somewhat error prone. Though I'm not sure if there is some better way to handle it. (Possibly a structure that holds both global and per-use flags, so it's clearer at construction which is being used.)

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


More information about the llvm-commits mailing list