summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Analysis/AffineStructures.cpp
diff options
context:
space:
mode:
authorUday Bondhugula <bondhugula@google.com>2018-12-28 15:34:07 -0800
committerjpienaar <jpienaar@google.com>2019-03-29 14:44:14 -0700
commitb1d9cc4d1ef5a1f81ca566fc06960df2bf31ddfe (patch)
tree3f364641daa4be7fba96a1423dae8c61caae1153 /mlir/lib/Analysis/AffineStructures.cpp
parent315a466aed9bcc896007098719ed9e0a35a3459d (diff)
downloadbcm5719-llvm-b1d9cc4d1ef5a1f81ca566fc06960df2bf31ddfe.tar.gz
bcm5719-llvm-b1d9cc4d1ef5a1f81ca566fc06960df2bf31ddfe.zip
Extend/complete dependence tester to utilize local var info.
- extend/complete dependence tester to utilize local var info while adding access function equality constraints; one more step closer to get slicing based fusion working in the general case of affine_apply's involving mod's/div's. - update test case to reflect more accurate dependence information; remove inaccurate comment on test case mod_deps. - fix a minor "bug" in equality addition in addMemRefAccessConstraints (doesn't affect correctness, but the fixed version is more intuitive). - some more surrounding code clean up - move simplifyAffineExpr out of anonymous AffineExprFlattener class - the latter has state, and the former should reside outside. PiperOrigin-RevId: 227175600
Diffstat (limited to 'mlir/lib/Analysis/AffineStructures.cpp')
-rw-r--r--mlir/lib/Analysis/AffineStructures.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/mlir/lib/Analysis/AffineStructures.cpp b/mlir/lib/Analysis/AffineStructures.cpp
index dd564df3017..a45c5ffdf5e 100644
--- a/mlir/lib/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Analysis/AffineStructures.cpp
@@ -1102,13 +1102,15 @@ AffineMap FlatAffineConstraints::toAffineMapFromEq(
unsigned idx, unsigned pos, MLIRContext *context,
SmallVectorImpl<unsigned> *nonZeroDimIds,
SmallVectorImpl<unsigned> *nonZeroSymbolIds) {
- assert(getNumLocalIds() == 0);
- assert(idx < getNumEqualities());
+ assert(getNumLocalIds() == 0 && "local ids not supported");
+ assert(idx < getNumEqualities() && "invalid equality position");
+
int64_t v = atEq(idx, pos);
// Return if coefficient at (idx, pos) is zero or does not divide constant.
if (v == 0 || (atEq(idx, getNumIds()) % v != 0))
return AffineMap::Null();
- // Check that coefficient at 'pos' divides all other coefficient in row 'idx'.
+ // Check that coefficient at 'pos' divides all other coefficients in row
+ // 'idx'.
for (unsigned j = 0, e = getNumIds(); j < e; ++j) {
if (j != pos && (atEq(idx, j) % v != 0))
return AffineMap::Null();
@@ -1441,7 +1443,7 @@ void FlatAffineConstraints::constantFoldIdRange(unsigned pos, unsigned num) {
// i + s0 + 16 <= d0 <= i + s0 + 31, returns 16.
Optional<int64_t> FlatAffineConstraints::getConstantBoundOnDimSize(
unsigned pos, SmallVectorImpl<int64_t> *lb) const {
- assert(pos < getNumDimIds() && "Invalid position");
+ assert(pos < getNumDimIds() && "Invalid identifier position");
assert(getNumLocalIds() == 0);
// TODO(bondhugula): eliminate all remaining dimensional identifiers (other
OpenPOWER on IntegriCloud