Skip to content

Commit 27c2fa4

Browse files
[mlir][Analysis] Revert D107221
This is in preparation of a larger refactoring that makes the changes in D107221 obsolete. Differential Revision: https://reviews.llvm.org/D107724
1 parent 41e3ac3 commit 27c2fa4

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

mlir/include/mlir/Analysis/AffineStructures.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,10 @@ class FlatAffineConstraints {
237237
/// Adds a lower or an upper bound for the identifier at the specified
238238
/// position with constraints being drawn from the specified bound map and
239239
/// operands. If `eq` is true, add a single equality equal to the bound map's
240-
/// first result expr. By default, the bound map is fully composed with the
241-
/// operands before adding any bounds. This allows for bounds being expressed
242-
/// in terms of values that are used by the operands.
240+
/// first result expr.
243241
LogicalResult addLowerOrUpperBound(unsigned pos, AffineMap boundMap,
244242
ValueRange operands, bool eq,
245-
bool lower = true,
246-
bool composeMapAndOperands = true);
243+
bool lower = true);
247244

248245
/// Returns the bound for the identifier at `pos` from the inequality at
249246
/// `ineqPos` as a 1-d affine value map (affine map + operands). The returned
@@ -337,9 +334,7 @@ class FlatAffineConstraints {
337334
/// symbols or loop IVs. The identifier is added to the end of the existing
338335
/// dims or symbols. Additional information on the identifier is extracted
339336
/// from the IR and added to the constraint system.
340-
/// Note: If `allowNonTerminal`, any symbol (incl. potentially non-terminal
341-
/// ones) is allowed.
342-
void addInductionVarOrTerminalSymbol(Value id, bool allowNonTerminal = false);
337+
void addInductionVarOrTerminalSymbol(Value id);
343338

344339
/// Composes the affine value map with this FlatAffineConstrains, adding the
345340
/// results of the map as dimensions at the front [0, vMap->getNumResults())

mlir/lib/Analysis/AffineStructures.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,12 @@ void FlatAffineConstraints::convertLoopIVSymbolsToDims() {
560560
}
561561
}
562562

563-
void FlatAffineConstraints::addInductionVarOrTerminalSymbol(
564-
Value id, bool allowNonTerminal) {
563+
void FlatAffineConstraints::addInductionVarOrTerminalSymbol(Value id) {
565564
if (containsId(id))
566565
return;
567566

568567
// Caller is expected to fully compose map/operands if necessary.
569-
assert((allowNonTerminal || isTopLevelValue(id) || isForInductionVar(id)) &&
568+
assert((isTopLevelValue(id) || isForInductionVar(id)) &&
570569
"non-terminal symbol / loop IV expected");
571570
// Outer loop IVs could be used in forOp's bounds.
572571
if (auto loop = getForInductionVarOwner(id)) {
@@ -1945,9 +1944,10 @@ void FlatAffineConstraints::getSliceBounds(unsigned offset, unsigned num,
19451944
}
19461945
}
19471946

1948-
LogicalResult FlatAffineConstraints::addLowerOrUpperBound(
1949-
unsigned pos, AffineMap boundMap, ValueRange boundOperands, bool eq,
1950-
bool lower, bool composeMapAndOperands) {
1947+
LogicalResult
1948+
FlatAffineConstraints::addLowerOrUpperBound(unsigned pos, AffineMap boundMap,
1949+
ValueRange boundOperands, bool eq,
1950+
bool lower) {
19511951
assert(pos < getNumDimAndSymbolIds() && "invalid position");
19521952
// Equality follows the logic of lower bound except that we add an equality
19531953
// instead of an inequality.
@@ -1959,13 +1959,11 @@ LogicalResult FlatAffineConstraints::addLowerOrUpperBound(
19591959
// transitively get to terminal symbols or loop IVs.
19601960
auto map = boundMap;
19611961
SmallVector<Value, 4> operands(boundOperands.begin(), boundOperands.end());
1962-
if (composeMapAndOperands)
1963-
fullyComposeAffineMapAndOperands(&map, &operands);
1962+
fullyComposeAffineMapAndOperands(&map, &operands);
19641963
map = simplifyAffineMap(map);
19651964
canonicalizeMapAndOperands(&map, &operands);
19661965
for (auto operand : operands)
1967-
addInductionVarOrTerminalSymbol(
1968-
operand, /*allowNonTerminal=*/!composeMapAndOperands);
1966+
addInductionVarOrTerminalSymbol(operand);
19691967

19701968
FlatAffineConstraints localVarCst;
19711969
std::vector<SmallVector<int64_t, 8>> flatExprs;

0 commit comments

Comments
 (0)