[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
This commit is contained in:
Matthias Springer
2021-08-10 10:16:50 +09:00
parent 41e3ac398c
commit 27c2fa4f05
2 changed files with 11 additions and 18 deletions

View File

@@ -237,13 +237,10 @@ public:
/// Adds a lower or an upper bound for the identifier at the specified
/// position with constraints being drawn from the specified bound map and
/// operands. If `eq` is true, add a single equality equal to the bound map's
/// first result expr. By default, the bound map is fully composed with the
/// operands before adding any bounds. This allows for bounds being expressed
/// in terms of values that are used by the operands.
/// first result expr.
LogicalResult addLowerOrUpperBound(unsigned pos, AffineMap boundMap,
ValueRange operands, bool eq,
bool lower = true,
bool composeMapAndOperands = true);
bool lower = true);
/// Returns the bound for the identifier at `pos` from the inequality at
/// `ineqPos` as a 1-d affine value map (affine map + operands). The returned
@@ -337,9 +334,7 @@ public:
/// symbols or loop IVs. The identifier is added to the end of the existing
/// dims or symbols. Additional information on the identifier is extracted
/// from the IR and added to the constraint system.
/// Note: If `allowNonTerminal`, any symbol (incl. potentially non-terminal
/// ones) is allowed.
void addInductionVarOrTerminalSymbol(Value id, bool allowNonTerminal = false);
void addInductionVarOrTerminalSymbol(Value id);
/// Composes the affine value map with this FlatAffineConstrains, adding the
/// results of the map as dimensions at the front [0, vMap->getNumResults())

View File

@@ -560,13 +560,12 @@ void FlatAffineConstraints::convertLoopIVSymbolsToDims() {
}
}
void FlatAffineConstraints::addInductionVarOrTerminalSymbol(
Value id, bool allowNonTerminal) {
void FlatAffineConstraints::addInductionVarOrTerminalSymbol(Value id) {
if (containsId(id))
return;
// Caller is expected to fully compose map/operands if necessary.
assert((allowNonTerminal || isTopLevelValue(id) || isForInductionVar(id)) &&
assert((isTopLevelValue(id) || isForInductionVar(id)) &&
"non-terminal symbol / loop IV expected");
// Outer loop IVs could be used in forOp's bounds.
if (auto loop = getForInductionVarOwner(id)) {
@@ -1945,9 +1944,10 @@ void FlatAffineConstraints::getSliceBounds(unsigned offset, unsigned num,
}
}
LogicalResult FlatAffineConstraints::addLowerOrUpperBound(
unsigned pos, AffineMap boundMap, ValueRange boundOperands, bool eq,
bool lower, bool composeMapAndOperands) {
LogicalResult
FlatAffineConstraints::addLowerOrUpperBound(unsigned pos, AffineMap boundMap,
ValueRange boundOperands, bool eq,
bool lower) {
assert(pos < getNumDimAndSymbolIds() && "invalid position");
// Equality follows the logic of lower bound except that we add an equality
// instead of an inequality.
@@ -1959,13 +1959,11 @@ LogicalResult FlatAffineConstraints::addLowerOrUpperBound(
// transitively get to terminal symbols or loop IVs.
auto map = boundMap;
SmallVector<Value, 4> operands(boundOperands.begin(), boundOperands.end());
if (composeMapAndOperands)
fullyComposeAffineMapAndOperands(&map, &operands);
fullyComposeAffineMapAndOperands(&map, &operands);
map = simplifyAffineMap(map);
canonicalizeMapAndOperands(&map, &operands);
for (auto operand : operands)
addInductionVarOrTerminalSymbol(
operand, /*allowNonTerminal=*/!composeMapAndOperands);
addInductionVarOrTerminalSymbol(operand);
FlatAffineConstraints localVarCst;
std::vector<SmallVector<int64_t, 8>> flatExprs;