aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormakslevental <maksim.levental@gmail.com>2025-08-13 14:03:28 -0400
committermakslevental <maksim.levental@gmail.com>2025-08-13 14:03:28 -0400
commit5684d14131ea902e5b83dbaf1716ac6b37fd34d7 (patch)
treed95a359a57f1747bf956d4a98bfa9593bb809025
parent4d3feaea66f43758518d15e07a975e3492317b1c (diff)
downloadllvm-users/makslevental/revert-jeff.zip
llvm-users/makslevental/revert-jeff.tar.gz
llvm-users/makslevental/revert-jeff.tar.bz2
Revert "[mlir] IntegerRangeAnalysis: return initialized state for noninteger values (#133541)"users/makslevental/revert-jeff
This reverts commit 5252bb1d
-rw-r--r--mlir/lib/Interfaces/InferIntRangeInterface.cpp3
-rw-r--r--mlir/test/Dialect/Arith/int-range-interface.mlir20
2 files changed, 4 insertions, 19 deletions
diff --git a/mlir/lib/Interfaces/InferIntRangeInterface.cpp b/mlir/lib/Interfaces/InferIntRangeInterface.cpp
index 9f3e97d..1801e3f 100644
--- a/mlir/lib/Interfaces/InferIntRangeInterface.cpp
+++ b/mlir/lib/Interfaces/InferIntRangeInterface.cpp
@@ -134,6 +134,9 @@ raw_ostream &mlir::operator<<(raw_ostream &os, const ConstantIntRanges &range) {
IntegerValueRange IntegerValueRange::getMaxRange(Value value) {
unsigned width = ConstantIntRanges::getStorageBitwidth(value.getType());
+ if (width == 0)
+ return {};
+
APInt umin = APInt::getMinValue(width);
APInt umax = APInt::getMaxValue(width);
APInt smin = width != 0 ? APInt::getSignedMinValue(width) : umin;
diff --git a/mlir/test/Dialect/Arith/int-range-interface.mlir b/mlir/test/Dialect/Arith/int-range-interface.mlir
index 2128d36..090af3e 100644
--- a/mlir/test/Dialect/Arith/int-range-interface.mlir
+++ b/mlir/test/Dialect/Arith/int-range-interface.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt -allow-unregistered-dialect -int-range-optimizations -canonicalize %s | FileCheck %s
+// RUN: mlir-opt -int-range-optimizations -canonicalize %s | FileCheck %s
// CHECK-LABEL: func @add_min_max
// CHECK: %[[c3:.*]] = arith.constant 3 : index
@@ -1013,21 +1013,3 @@ func.func @zero_trip_loop2() {
}
return
}
-
-// CHECK-LABEL: @noninteger_operation_result
-func.func @noninteger_operation_result(%lb: index, %ub: index, %step: index, %cond: i1) {
- %c1_i32 = arith.constant 1 : i32
-
- %0 = "some_fp_op"() : () -> f32
- // CHECK: [[OUTS:%.*]]:2 = scf.for
- %outs:2 = scf.for %i = %lb to %ub step %step iter_args(%a = %c1_i32, %b = %0) -> (i32, f32) {
- %1:2 = "some_op"() : () -> (i32, f32)
- scf.yield %1#0, %1#1 : i32, f32
- }
-
- // CHECK: [[RESULT:%.*]] = arith.select %{{.*}}, %c1_i32, [[OUTS]]#0
- %result = arith.select %cond, %c1_i32, %outs#0 : i32
- // CHECK: "use"([[RESULT]], [[OUTS]]#1)
- "use"(%result, %outs#1) : (i32, f32) -> ()
- return
-}