diff options
| author | Uday Bondhugula <bondhugula@google.com> | 2019-01-15 14:41:56 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 15:19:41 -0700 |
| commit | 03e15e1b9f84a7bed35ff4065ad7135b571d2d65 (patch) | |
| tree | a5fad41c04d17071289216969017d2aa452e0304 /mlir/lib/Transforms/Utils/Utils.cpp | |
| parent | b7dbfd04ebd80577f38f4922e857ad821b908ff1 (diff) | |
| download | bcm5719-llvm-03e15e1b9f84a7bed35ff4065ad7135b571d2d65.tar.gz bcm5719-llvm-03e15e1b9f84a7bed35ff4065ad7135b571d2d65.zip | |
Minor code cleanup - NFC.
- readability changes
PiperOrigin-RevId: 229443430
Diffstat (limited to 'mlir/lib/Transforms/Utils/Utils.cpp')
| -rw-r--r-- | mlir/lib/Transforms/Utils/Utils.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mlir/lib/Transforms/Utils/Utils.cpp b/mlir/lib/Transforms/Utils/Utils.cpp index f85847ff066..4f4aeabb26d 100644 --- a/mlir/lib/Transforms/Utils/Utils.cpp +++ b/mlir/lib/Transforms/Utils/Utils.cpp @@ -123,9 +123,6 @@ bool mlir::replaceAllMemRefUsesWith(const Value *oldMemRef, Value *newMemRef, FuncBuilder builder(opInst); for (auto *extraIndex : extraIndices) { - // TODO(mlir-team): An operation/SSA value should provide a method to - // return the position of an SSA result in its defining - // operation. assert(extraIndex->getDefiningInst()->getNumResults() == 1 && "single result op's expected to generate these indices"); assert((extraIndex->isValidDim() || extraIndex->isValidSymbol()) && @@ -137,7 +134,7 @@ bool mlir::replaceAllMemRefUsesWith(const Value *oldMemRef, Value *newMemRef, // provided. The indices of a memref come right after it, i.e., // at position memRefOperandPos + 1. SmallVector<Value *, 4> remapOperands; - remapOperands.reserve(oldMemRefRank + extraOperands.size()); + remapOperands.reserve(extraOperands.size() + oldMemRefRank); remapOperands.append(extraOperands.begin(), extraOperands.end()); remapOperands.append(opInst->operand_begin() + memRefOperandPos + 1, opInst->operand_begin() + memRefOperandPos + 1 + @@ -146,12 +143,11 @@ bool mlir::replaceAllMemRefUsesWith(const Value *oldMemRef, Value *newMemRef, auto remapOp = builder.create<AffineApplyOp>(opInst->getLoc(), indexRemap, remapOperands); // Remapped indices. - for (auto *index : remapOp->getInstruction()->getResults()) - state.operands.push_back(index); + state.operands.append(remapOp->getInstruction()->result_begin(), + remapOp->getInstruction()->result_end()); } else { // No remapping specified. - for (auto *index : remapOperands) - state.operands.push_back(index); + state.operands.append(remapOperands.begin(), remapOperands.end()); } // Insert the remaining operands unmodified. |

