diff options
author | Chris Lattner <clattner@google.com> | 2019-05-11 08:28:15 -0700 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2019-05-20 13:36:17 -0700 |
commit | 0134b5df3a00018f7db2a0ee5be6c4abf9bee4b2 (patch) | |
tree | 6ef2be0983de121801a53540cb8ac7b0819acff3 /mlir | |
parent | ecd4c7d67af8d167c51fbd86dbfcfca5bbc22102 (diff) | |
download | llvm-0134b5df3a00018f7db2a0ee5be6c4abf9bee4b2.zip llvm-0134b5df3a00018f7db2a0ee5be6c4abf9bee4b2.tar.gz llvm-0134b5df3a00018f7db2a0ee5be6c4abf9bee4b2.tar.bz2 |
Cleanups and simplifications to code, noticed by inspection. NFC.
--
PiperOrigin-RevId: 247758075
Diffstat (limited to 'mlir')
-rw-r--r-- | mlir/lib/Analysis/SliceAnalysis.cpp | 2 | ||||
-rw-r--r-- | mlir/lib/Transforms/LoopFusion.cpp | 2 | ||||
-rw-r--r-- | mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | 24 | ||||
-rw-r--r-- | mlir/lib/Transforms/LoopTiling.cpp | 3 |
4 files changed, 7 insertions, 24 deletions
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp index 496c0b3..bce000a 100644 --- a/mlir/lib/Analysis/SliceAnalysis.cpp +++ b/mlir/lib/Analysis/SliceAnalysis.cpp @@ -25,9 +25,7 @@ #include "mlir/IR/Operation.h" #include "mlir/Support/Functional.h" #include "mlir/Support/STLExtras.h" - #include "llvm/ADT/SetVector.h" -#include <type_traits> /// /// Implements Analysis functions specific to slicing in Function. diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp index fda6574..796d216 100644 --- a/mlir/lib/Transforms/LoopFusion.cpp +++ b/mlir/lib/Transforms/LoopFusion.cpp @@ -39,8 +39,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include <iomanip> -#include <sstream> - #define DEBUG_TYPE "affine-loop-fusion" using llvm::SetVector; diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index b03a3c7..2f95db9 100644 --- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp +++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp @@ -19,9 +19,6 @@ // //===----------------------------------------------------------------------===// -#include <iomanip> -#include <sstream> - #include "mlir/AffineOps/AffineOps.h" #include "mlir/Analysis/AffineAnalysis.h" #include "mlir/Analysis/AffineStructures.h" @@ -57,7 +54,6 @@ namespace { struct LoopInvariantCodeMotion : public FunctionPass<LoopInvariantCodeMotion> { void runOnFunction() override; void runOnAffineForOp(AffineForOp forOp); - std::vector<AffineForOp> forOps; }; } // end anonymous namespace @@ -81,7 +77,7 @@ void LoopInvariantCodeMotion::runOnAffineForOp(AffineForOp forOp) { LLVM_DEBUG(for (auto i : loopDefinedOps) { - (i->print(llvm::dbgs() << "\nLoop-dependent op\n")); + i->print(llvm::dbgs() << "\nLoop-dependent op\n"); }); for (auto &op : *loopBody) { @@ -109,20 +105,14 @@ void LoopInvariantCodeMotion::runOnAffineForOp(AffineForOp forOp) { } void LoopInvariantCodeMotion::runOnFunction() { - forOps.clear(); - - // Gather all loops in a function, and order them in innermost-loop-first - // order. This way, we first LICM from the inner loop, and place the ops in - // the outer loop, which in turn can be further LICM'ed. This saves iterating - // on the inner loop operations while LICMing through the outer loop. - getFunction().walk<AffineForOp>( - [&](AffineForOp forOp) { forOps.push_back(forOp); }); - // We gather loops first, and then go over them later because we don't want to - // mess the iterators up. - for (auto op : forOps) { + + // Walk through all loops in a function in innermost-loop-first order. This + // way, we first LICM from the inner loop, and place the ops in + // the outer loop, which in turn can be further LICM'ed. + getFunction().walk<AffineForOp>([&](AffineForOp op) { LLVM_DEBUG(op.getOperation()->print(llvm::dbgs() << "\nOriginal loop\n")); runOnAffineForOp(op); - } + }); } static PassRegistration<LoopInvariantCodeMotion> diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp index 303193b..ce42a5e 100644 --- a/mlir/lib/Transforms/LoopTiling.cpp +++ b/mlir/lib/Transforms/LoopTiling.cpp @@ -31,9 +31,6 @@ #include "mlir/Transforms/Utils.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" -#include <iomanip> -#include <sstream> - using namespace mlir; #define DEBUG_TYPE "affine-loop-tile" |