aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-08-30 16:49:01 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-08-30 16:49:32 -0700
commit9c8a8a7d0da011f1570733265020a40079127b05 (patch)
treed73a6a1837ecbb4e76e1cd1d1478e69102c95f33 /mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
parent3d3f62323c820ed90bef4378ae2e3f23f542ca81 (diff)
downloadllvm-9c8a8a7d0da011f1570733265020a40079127b05.zip
llvm-9c8a8a7d0da011f1570733265020a40079127b05.tar.gz
llvm-9c8a8a7d0da011f1570733265020a40079127b05.tar.bz2
Add a canonicalization to erase empty AffineForOps.
AffineForOp themselves are pure and can be removed if there are no internal operations. PiperOrigin-RevId: 266481293
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
-rw-r--r--mlir/lib/Transforms/LoopInvariantCodeMotion.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
index be39297..6150996 100644
--- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
@@ -228,12 +228,6 @@ void LoopInvariantCodeMotion::runOnAffineForOp(AffineForOp forOp) {
}
LLVM_DEBUG(forOp.getOperation()->print(llvm::dbgs() << "Modified loop\n"));
-
- // If the for loop body has a single operation (the terminator), erase it.
- if (forOp.getBody()->getOperations().size() == 1) {
- assert(isa<AffineTerminatorOp>(forOp.getBody()->front()));
- forOp.erase();
- }
}
void LoopInvariantCodeMotion::runOnFunction() {