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

via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 05:17:23 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 /
----------------
XChy wrote:

Could you please provide a negative test or an example? It's hard for me to imagine it.

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


More information about the llvm-commits mailing list