Skip to content

Conversation

@makslevental
Copy link
Contributor

This reverts commit 5252bb1

See discussion #134003

@llvmbot
Copy link
Member

llvmbot commented Aug 13, 2025

@llvm/pr-subscribers-mlir-arith

@llvm/pr-subscribers-mlir

Author: Maksim Levental (makslevental)

Changes

This reverts commit 5252bb1

See discussion #134003


Full diff: https://github.com/llvm/llvm-project/pull/153456.diff

2 Files Affected:

  • (modified) mlir/lib/Interfaces/InferIntRangeInterface.cpp (+3)
  • (modified) mlir/test/Dialect/Arith/int-range-interface.mlir (+1-19)
diff --git a/mlir/lib/Interfaces/InferIntRangeInterface.cpp b/mlir/lib/Interfaces/InferIntRangeInterface.cpp
index 9f3e97d051c85..1801e3f7c52fd 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 2128d36f1a28e..090af3e79f4a1 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
-}

@makslevental makslevental requested a review from krzysz00 August 13, 2025 18:09
@makslevental
Copy link
Contributor Author

ping

@krzysz00
Copy link
Contributor

I don't think the discussion on that PR endorses this revert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants