[Mlir-commits] [mlir] [mlir] IntegerRangeAnalysis: add support for vector type (PR #112292)

Ivan Butygin llvmlistbot at llvm.org
Thu Oct 31 16:18:02 PDT 2024


================
@@ -35,10 +35,27 @@ convertArithOverflowFlags(arith::IntegerOverflowFlags flags) {
 
 void arith::ConstantOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
                                           SetIntRangeFn setResultRange) {
-  auto constAttr = llvm::dyn_cast_or_null<IntegerAttr>(getValue());
-  if (constAttr) {
+  if (auto constAttr = llvm::dyn_cast_or_null<IntegerAttr>(getValue())) {
     const APInt &value = constAttr.getValue();
     setResultRange(getResult(), ConstantIntRanges::constant(value));
+    return;
+  }
+  if (auto constAttr =
+          llvm::dyn_cast_or_null<DenseIntElementsAttr>(getValue())) {
+    std::optional<ConstantIntRanges> result;
+    for (APInt &&val : constAttr) {
----------------
Hardcode84 wrote:

fixed

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


More information about the Mlir-commits mailing list