[llvm] [ConstantRange][LVI] Add initial support for `multiplyWithNoWrap` (PR #92356)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 13:38:29 PDT 2024


================
@@ -1167,6 +1169,28 @@ ConstantRange::multiply(const ConstantRange &Other) const {
   return UR.isSizeStrictlySmallerThan(SR) ? UR : SR;
 }
 
+ConstantRange
+ConstantRange::multiplyWithNoWrap(const ConstantRange &Other,
+                                  unsigned NoWrapKind,
+                                  PreferredRangeType RangeType) const {
+  if (isEmptySet() || Other.isEmptySet())
+    return getEmpty();
+
+  ConstantRange Result = multiply(Other);
+
+  // TODO: Bounds are not yet precise if the input sets are non-wrapped /
----------------
antoniofrighetto wrote:

For example, given input ranges `[0,2)` and `[2,0)` (bitwidth: 4), we currently return `full-set`, but a more refined CR would be `[2,1)`.

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


More information about the llvm-commits mailing list