[MLIR] Fix incorrect assertion in memref replacement utility
authorUday Bondhugula <uday@polymagelabs.com>
Thu, 17 Nov 2022 10:18:25 +0000 (15:48 +0530)
committerUday Bondhugula <uday@polymagelabs.com>
Sat, 19 Nov 2022 07:04:27 +0000 (12:34 +0530)
The assertion had an unchecked use of getDefiningOp. The condition
itself is stale and not needed. This is a trivial/obvious fix - the
buggy path wasn't exercised since the current passes/users of this
utility always passed the result of an op as an "extra index".

Differential Revision: https://reviews.llvm.org/D138191

mlir/lib/Dialect/Affine/Utils/Utils.cpp

index 9f074a4..2d4ecc8 100644 (file)
@@ -1199,8 +1199,6 @@ LogicalResult mlir::replaceAllMemRefUsesWith(Value oldMemRef, Value newMemRef,
 
   // Prepend 'extraIndices' in 'newMapOperands'.
   for (Value extraIndex : extraIndices) {
-    assert(extraIndex.getDefiningOp()->getNumResults() == 1 &&
-           "single result op's expected to generate these indices");
     assert((isValidDim(extraIndex) || isValidSymbol(extraIndex)) &&
            "invalid memory op index");
     newMapOperands.push_back(extraIndex);