[Mlir-commits] [mlir] [mlir][NFC] IntegerRangeAnalysis: don't loop over splat attr (PR #115399)
Jakub Kuderski
llvmlistbot at llvm.org
Fri Nov 8 09:54:21 PST 2024
================
@@ -42,6 +42,12 @@ void arith::ConstantOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
}
if (auto arrayCstAttr =
llvm::dyn_cast_or_null<DenseIntElementsAttr>(getValue())) {
+ if (arrayCstAttr.isSplat()) {
+ setResultRange(getResult(), ConstantIntRanges::constant(
+ arrayCstAttr.getSplatValue<APInt>()));
----------------
kuhar wrote:
The alternative is that you can still cast to SplatElementsAttr and then check the element type. Either way is fine.
https://github.com/llvm/llvm-project/pull/115399
More information about the Mlir-commits
mailing list