[Mlir-commits] [mlir] [mlir] IntegerRangeAnalysis: don't loop over splat attr (PR #115229)

Jakub Kuderski llvmlistbot at llvm.org
Wed Nov 6 15:29:18 PST 2024


================
@@ -42,13 +42,19 @@ void arith::ConstantOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
   }
   if (auto arrayCstAttr =
           llvm::dyn_cast_or_null<DenseIntElementsAttr>(getValue())) {
+    assert(arrayCstAttr.size() && "Zero-sized vectors are not allowed");
+    if (arrayCstAttr.isSplat()) {
+      setResultRange(getResult(), ConstantIntRanges::constant(
----------------
kuhar wrote:

you can and an `if` before this one and check using `dyn_cast_or_null<SplatElementsAttr>(...)`

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


More information about the Mlir-commits mailing list