From 9c8a8a7d0da011f1570733265020a40079127b05 Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 30 Aug 2019 16:49:01 -0700 Subject: Add a canonicalization to erase empty AffineForOps. AffineForOp themselves are pure and can be removed if there are no internal operations. PiperOrigin-RevId: 266481293 --- mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp') diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index be39297a4b2..6150996a3d4 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(forOp.getBody()->front())); - forOp.erase(); - } } void LoopInvariantCodeMotion::runOnFunction() { -- cgit v1.2.3