Skip to content

Commit 3ee25c8

Browse files
committed
refine
1 parent 7e74df5 commit 3ee25c8

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

mlir/lib/Analysis/FlatLinearValueConstraints.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ struct AffineExprFlattener : public SimpleAffineExprFlattener {
6767
} // namespace
6868

6969
// Flattens the expressions in map. Returns failure if 'expr' was unable to be
70-
// flattened (i.e., semi-affine expressions not handled yet).
70+
// flattened.For example two specific cases:
71+
// 1. semi-affine expressions not handled yet.
72+
// 2. has poison expression (i.e., division by zero).
7173
static LogicalResult
7274
getFlattenedAffineExprs(ArrayRef<AffineExpr> exprs, unsigned numDims,
7375
unsigned numSymbols,

mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,14 @@ getBoundForExpr(AffineExpr expr, unsigned numDims, unsigned numSymbols,
786786
// symbolic input depending on `isUpper` to determine the bound.
787787
for (unsigned i = 0, e = numDims + numSymbols; i < e; ++i) {
788788
if (flattenedExpr[i] > 0) {
789-
auto &constBound = isUpper ? constUpperBounds[i] : constLowerBounds[i];
789+
const std::optional<int64_t> &constBound =
790+
isUpper ? constUpperBounds[i] : constLowerBounds[i];
790791
if (!constBound)
791792
return std::nullopt;
792793
bound += *constBound * flattenedExpr[i];
793794
} else if (flattenedExpr[i] < 0) {
794-
auto &constBound = isUpper ? constLowerBounds[i] : constUpperBounds[i];
795+
const std::optional<int64_t> &constBound =
796+
isUpper ? constLowerBounds[i] : constUpperBounds[i];
795797
if (!constBound)
796798
return std::nullopt;
797799
bound += *constBound * flattenedExpr[i];

mlir/lib/Dialect/Affine/IR/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ add_mlir_dialect_library(MLIRAffineDialect
1616
MLIRDialectUtils
1717
MLIRIR
1818
MLIRLoopLikeInterface
19+
MLIRMemRefDialect
1920
MLIRShapedOpInterfaces
2021
MLIRSideEffectInterfaces
2122
MLIRValueBoundsOpInterface
22-
MLIRMemRefDialect
2323
MLIRUBDialect
2424
)

0 commit comments

Comments
 (0)