File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
180
180
} else if (auto value = llvm::dyn_cast_if_present<Value>(*loopBound)) {
181
181
const IntegerValueRangeLattice *lattice =
182
182
getLatticeElementFor (op, value);
183
- if (lattice != nullptr )
183
+ if (lattice != nullptr && !lattice-> getValue (). isUninitialized () )
184
184
return getUpper ? lattice->getValue ().getValue ().smax ()
185
185
: lattice->getValue ().getValue ().smin ();
186
186
}
Original file line number Diff line number Diff line change @@ -730,3 +730,29 @@ func.func @extui_uses_unsigned(%arg0 : i32) -> i1 {
730
730
%4 = arith.andi %2 , %3 : i1
731
731
func.return %4 : i1
732
732
}
733
+
734
+ /// Catch a bug that caused a crash in getLoopBoundFromFold when
735
+ /// SparseConstantPropagation is loaded in the solver.
736
+
737
+ // CHECK-LABEL: func.func @caller(
738
+ // CHECK-SAME: %[[VAL_0:.*]]: memref<?xindex, 4>) {
739
+ // CHECK: call @callee(%[[VAL_0]]) : (memref<?xindex, 4>) -> ()
740
+ // CHECK: return
741
+ // CHECK: }
742
+ func.func @caller (%arg0: memref <?xindex , 4 >) {
743
+ call @callee (%arg0 ) : (memref <?xindex , 4 >) -> ()
744
+ return
745
+ }
746
+
747
+ // CHECK-LABEL: func.func private @callee(
748
+ // CHECK-SAME: %[[VAL_0:.*]]: memref<?xindex, 4>) {
749
+ // CHECK: return
750
+ // CHECK: }
751
+ func.func private @callee (%arg0: memref <?xindex , 4 >) {
752
+ %c1 = arith.constant 1 : index
753
+ %c0 = arith.constant 0 : index
754
+ %0 = affine.load %arg0 [0 ] : memref <?xindex , 4 >
755
+ scf.for %arg1 = %c0 to %0 step %c1 {
756
+ }
757
+ return
758
+ }
Original file line number Diff line number Diff line change 9
9
// functionality has been integrated into SCCP.
10
10
// ===----------------------------------------------------------------------===//
11
11
12
+ #include " mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h"
12
13
#include " mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
13
14
#include " mlir/Analysis/DataFlow/IntegerRangeAnalysis.h"
14
15
#include " mlir/Interfaces/SideEffectInterfaces.h"
@@ -107,6 +108,7 @@ struct TestIntRangeInference
107
108
Operation *op = getOperation ();
108
109
DataFlowSolver solver;
109
110
solver.load <DeadCodeAnalysis>();
111
+ solver.load <SparseConstantPropagation>();
110
112
solver.load <IntegerRangeAnalysis>();
111
113
if (failed (solver.initializeAndRun (op)))
112
114
return signalPassFailure ();
You can’t perform that action at this time.
0 commit comments