[Mlir-commits] [mlir] [mlir][dataflow] Fix for integer range analysis propagation bug (PR #93199)
Spenser Bauman
llvmlistbot at llvm.org
Fri May 24 04:05:18 PDT 2024
================
@@ -46,243 +45,271 @@ void arith::ConstantOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
// AddIOp
//===----------------------------------------------------------------------===//
-void arith::AddIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
+void arith::AddIOp::inferResultRanges(ArrayRef<OptionalIntRanges> argRanges,
SetIntRangeFn setResultRange) {
- setResultRange(getResult(), inferAdd(argRanges, convertArithOverflowFlags(
- getOverflowFlags())));
+ auto infer = inferFromOptionals([this](ArrayRef<ConstantIntRanges> ranges) {
+ return inferAdd(ranges, convertArithOverflowFlags(getOverflowFlags()));
+ });
+
+ setResultRange(getResult(), infer(argRanges));
}
//===----------------------------------------------------------------------===//
// SubIOp
//===----------------------------------------------------------------------===//
-void arith::SubIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
+void arith::SubIOp::inferResultRanges(ArrayRef<OptionalIntRanges> argRanges,
SetIntRangeFn setResultRange) {
- setResultRange(getResult(), inferSub(argRanges, convertArithOverflowFlags(
- getOverflowFlags())));
+ auto infer = inferFromOptionals([this](ArrayRef<ConstantIntRanges> ranges) {
+ return inferSub(ranges, convertArithOverflowFlags(getOverflowFlags()));
+ });
+
+ setResultRange(getResult(), infer(argRanges));
}
//===----------------------------------------------------------------------===//
// MulIOp
//===----------------------------------------------------------------------===//
-void arith::MulIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
+void arith::MulIOp::inferResultRanges(ArrayRef<OptionalIntRanges> argRanges,
SetIntRangeFn setResultRange) {
- setResultRange(getResult(), inferMul(argRanges, convertArithOverflowFlags(
- getOverflowFlags())));
+ auto infer = inferFromOptionals([this](ArrayRef<ConstantIntRanges> ranges) {
----------------
sabauma wrote:
I'll try changing this to `std::function`. Given how this function returns a lambda which captures the `function_ref`, I think there is a good chance this is related to the crashes.
https://github.com/llvm/llvm-project/pull/93199
More information about the Mlir-commits
mailing list