summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-02-04 10:30:45 -0800
committerjpienaar <jpienaar@google.com>2019-03-29 16:10:24 -0700
commita3d9ccaecbea042b59073ec34c91a343c1903a5c (patch)
tree1342654690b36c32eb483cc9789e7af67be6c560 /mlir/lib/Transforms
parent9ca0691b06a421acf2dedd6dd72392e1dcfa1638 (diff)
downloadbcm5719-llvm-a3d9ccaecbea042b59073ec34c91a343c1903a5c.tar.gz
bcm5719-llvm-a3d9ccaecbea042b59073ec34c91a343c1903a5c.zip
Replace the walkOps/visitOperationInst variants from the InstWalkers with the Instruction variants.
PiperOrigin-RevId: 232322030
Diffstat (limited to 'mlir/lib/Transforms')
-rw-r--r--mlir/lib/Transforms/ComposeAffineMaps.cpp4
-rw-r--r--mlir/lib/Transforms/ConstantFold.cpp4
-rw-r--r--mlir/lib/Transforms/LoopFusion.cpp4
-rw-r--r--mlir/lib/Transforms/LoopUnroll.cpp4
-rw-r--r--mlir/lib/Transforms/LoopUnrollAndJam.cpp2
-rw-r--r--mlir/lib/Transforms/LowerAffine.cpp2
-rw-r--r--mlir/lib/Transforms/MemRefDataFlowOpt.cpp4
-rw-r--r--mlir/lib/Transforms/PipelineDataTransfer.cpp2
-rw-r--r--mlir/lib/Transforms/SimplifyAffineStructures.cpp2
-rw-r--r--mlir/lib/Transforms/StripDebugInfo.cpp2
-rw-r--r--mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp2
-rw-r--r--mlir/lib/Transforms/Utils/LoopUtils.cpp2
-rw-r--r--mlir/lib/Transforms/Utils/Utils.cpp4
13 files changed, 19 insertions, 19 deletions
diff --git a/mlir/lib/Transforms/ComposeAffineMaps.cpp b/mlir/lib/Transforms/ComposeAffineMaps.cpp
index d7327d997c2..4f960ea73af 100644
--- a/mlir/lib/Transforms/ComposeAffineMaps.cpp
+++ b/mlir/lib/Transforms/ComposeAffineMaps.cpp
@@ -48,7 +48,7 @@ namespace {
struct ComposeAffineMaps : public FunctionPass, InstWalker<ComposeAffineMaps> {
explicit ComposeAffineMaps() : FunctionPass(&ComposeAffineMaps::passID) {}
PassResult runOnFunction(Function *f) override;
- void visitOperationInst(OperationInst *opInst);
+ void visitInstruction(OperationInst *opInst);
SmallVector<OpPointer<AffineApplyOp>, 8> affineApplyOps;
@@ -68,7 +68,7 @@ static bool affineApplyOp(const Instruction &inst) {
return opInst.isa<AffineApplyOp>();
}
-void ComposeAffineMaps::visitOperationInst(OperationInst *opInst) {
+void ComposeAffineMaps::visitInstruction(OperationInst *opInst) {
if (auto afOp = opInst->dyn_cast<AffineApplyOp>()) {
affineApplyOps.push_back(afOp);
}
diff --git a/mlir/lib/Transforms/ConstantFold.cpp b/mlir/lib/Transforms/ConstantFold.cpp
index 9c20e79180a..859d0012fac 100644
--- a/mlir/lib/Transforms/ConstantFold.cpp
+++ b/mlir/lib/Transforms/ConstantFold.cpp
@@ -37,7 +37,7 @@ struct ConstantFold : public FunctionPass, InstWalker<ConstantFold> {
bool foldOperation(OperationInst *op,
SmallVectorImpl<Value *> &existingConstants);
- void visitOperationInst(OperationInst *inst);
+ void visitInstruction(OperationInst *op);
PassResult runOnFunction(Function *f) override;
static char passID;
@@ -49,7 +49,7 @@ char ConstantFold::passID = 0;
/// Attempt to fold the specified operation, updating the IR to match. If
/// constants are found, we keep track of them in the existingConstants list.
///
-void ConstantFold::visitOperationInst(OperationInst *op) {
+void ConstantFold::visitInstruction(OperationInst *op) {
// If this operation is an AffineForOp, then fold the bounds.
if (auto forOp = op->dyn_cast<AffineForOp>()) {
constantFoldBounds(forOp);
diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp
index 162e0e3b7f6..304331320ac 100644
--- a/mlir/lib/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Transforms/LoopFusion.cpp
@@ -118,7 +118,7 @@ public:
SmallVector<OperationInst *, 4> storeOpInsts;
bool hasNonForRegion = false;
- void visitOperationInst(OperationInst *opInst) {
+ void visitInstruction(OperationInst *opInst) {
if (opInst->isa<AffineForOp>())
forOps.push_back(opInst->cast<AffineForOp>());
else if (opInst->getNumBlockLists() != 0)
@@ -619,7 +619,7 @@ public:
LoopNestStatsCollector(LoopNestStats *stats) : stats(stats) {}
- void visitOperationInst(OperationInst *opInst) {
+ void visitInstruction(OperationInst *opInst) {
auto forOp = opInst->dyn_cast<AffineForOp>();
if (!forOp)
return;
diff --git a/mlir/lib/Transforms/LoopUnroll.cpp b/mlir/lib/Transforms/LoopUnroll.cpp
index 86e913bd71f..9c9952d31ca 100644
--- a/mlir/lib/Transforms/LoopUnroll.cpp
+++ b/mlir/lib/Transforms/LoopUnroll.cpp
@@ -113,7 +113,7 @@ PassResult LoopUnroll::runOnFunction(Function *f) {
return hasInnerLoops;
}
- bool walkOpInstPostOrder(OperationInst *opInst) {
+ bool walkPostOrder(OperationInst *opInst) {
bool hasInnerLoops = false;
for (auto &blockList : opInst->getBlockLists())
for (auto &block : blockList)
@@ -140,7 +140,7 @@ PassResult LoopUnroll::runOnFunction(Function *f) {
const unsigned minTripCount;
ShortLoopGatherer(unsigned minTripCount) : minTripCount(minTripCount) {}
- void visitOperationInst(OperationInst *opInst) {
+ void visitInstruction(OperationInst *opInst) {
auto forOp = opInst->dyn_cast<AffineForOp>();
if (!forOp)
return;
diff --git a/mlir/lib/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Transforms/LoopUnrollAndJam.cpp
index 7327a37ee3a..d87f9d5dc14 100644
--- a/mlir/lib/Transforms/LoopUnrollAndJam.cpp
+++ b/mlir/lib/Transforms/LoopUnrollAndJam.cpp
@@ -196,7 +196,7 @@ bool mlir::loopUnrollJamByFactor(OpPointer<AffineForOp> forOp,
// Gather all sub-blocks to jam upon the loop being unrolled.
JamBlockGatherer jbg;
- jbg.walkOpInst(forInst);
+ jbg.walk(forInst);
auto &subBlocks = jbg.subBlocks;
// Generate the cleanup loop if trip count isn't a multiple of
diff --git a/mlir/lib/Transforms/LowerAffine.cpp b/mlir/lib/Transforms/LowerAffine.cpp
index 24ca4e95082..08c8188fada 100644
--- a/mlir/lib/Transforms/LowerAffine.cpp
+++ b/mlir/lib/Transforms/LowerAffine.cpp
@@ -615,7 +615,7 @@ PassResult LowerAffinePass::runOnFunction(Function *function) {
// Collect all the For instructions as well as AffineIfOps and AffineApplyOps.
// We do this as a prepass to avoid invalidating the walker with our rewrite.
- function->walkInsts([&](Instruction *inst) {
+ function->walk([&](Instruction *inst) {
auto op = cast<OperationInst>(inst);
if (op->isa<AffineApplyOp>() || op->isa<AffineForOp>() ||
op->isa<AffineIfOp>())
diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
index e6ce273b532..b9386c384dd 100644
--- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
+++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
@@ -75,7 +75,7 @@ struct MemRefDataFlowOpt : public FunctionPass, InstWalker<MemRefDataFlowOpt> {
PassResult runOnFunction(Function *f) override;
- void visitOperationInst(OperationInst *opInst);
+ void visitInstruction(OperationInst *opInst);
// A list of memref's that are potentially dead / could be eliminated.
SmallPtrSet<Value *, 4> memrefsToErase;
@@ -100,7 +100,7 @@ FunctionPass *mlir::createMemRefDataFlowOptPass() {
// This is a straightforward implementation not optimized for speed. Optimize
// this in the future if needed.
-void MemRefDataFlowOpt::visitOperationInst(OperationInst *opInst) {
+void MemRefDataFlowOpt::visitInstruction(OperationInst *opInst) {
OperationInst *lastWriteStoreOp = nullptr;
auto loadOp = opInst->dyn_cast<LoadOp>();
diff --git a/mlir/lib/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Transforms/PipelineDataTransfer.cpp
index 2e083bbfd79..8d13800160d 100644
--- a/mlir/lib/Transforms/PipelineDataTransfer.cpp
+++ b/mlir/lib/Transforms/PipelineDataTransfer.cpp
@@ -142,7 +142,7 @@ PassResult PipelineDataTransfer::runOnFunction(Function *f) {
// deleted and replaced by a prologue, a new steady-state loop and an
// epilogue).
forOps.clear();
- f->walkOpsPostOrder([&](OperationInst *opInst) {
+ f->walkPostOrder([&](OperationInst *opInst) {
if (auto forOp = opInst->dyn_cast<AffineForOp>())
forOps.push_back(forOp);
});
diff --git a/mlir/lib/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Transforms/SimplifyAffineStructures.cpp
index 80b2de130e7..a9fcfc5bd11 100644
--- a/mlir/lib/Transforms/SimplifyAffineStructures.cpp
+++ b/mlir/lib/Transforms/SimplifyAffineStructures.cpp
@@ -64,7 +64,7 @@ static IntegerSet simplifyIntegerSet(IntegerSet set) {
}
PassResult SimplifyAffineStructures::runOnFunction(Function *f) {
- f->walkOps([&](OperationInst *opInst) {
+ f->walk([&](OperationInst *opInst) {
for (auto attr : opInst->getAttrs()) {
if (auto mapAttr = attr.second.dyn_cast<AffineMapAttr>()) {
MutableAffineMap mMap(mapAttr.getValue());
diff --git a/mlir/lib/Transforms/StripDebugInfo.cpp b/mlir/lib/Transforms/StripDebugInfo.cpp
index 6e1d5ff2d11..c5e42b622ed 100644
--- a/mlir/lib/Transforms/StripDebugInfo.cpp
+++ b/mlir/lib/Transforms/StripDebugInfo.cpp
@@ -39,7 +39,7 @@ PassResult StripDebugInfo::runOnFunction(Function *f) {
// Strip the debug info from the function and its instructions.
f->setLoc(unknownLoc);
- f->walkInsts([&](Instruction *inst) { inst->setLoc(unknownLoc); });
+ f->walk([&](Instruction *inst) { inst->setLoc(unknownLoc); });
return success();
}
diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
index 019cbbae063..790f971bb58 100644
--- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
+++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
@@ -38,7 +38,7 @@ public:
worklist.reserve(64);
// Add all operations to the worklist.
- fn->walkOps([&](OperationInst *inst) { addToWorklist(inst); });
+ fn->walk([&](OperationInst *inst) { addToWorklist(inst); });
}
/// Perform the rewrites.
diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp
index 99079119dab..153557de04a 100644
--- a/mlir/lib/Transforms/Utils/LoopUtils.cpp
+++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp
@@ -135,7 +135,7 @@ bool mlir::promoteIfSingleIteration(OpPointer<AffineForOp> forOp) {
/// their body into the containing Block.
void mlir::promoteSingleIterationLoops(Function *f) {
// Gathers all innermost loops through a post order pruned walk.
- f->walkOpsPostOrder([](OperationInst *inst) {
+ f->walkPostOrder([](OperationInst *inst) {
if (auto forOp = inst->dyn_cast<AffineForOp>())
promoteIfSingleIteration(forOp);
});
diff --git a/mlir/lib/Transforms/Utils/Utils.cpp b/mlir/lib/Transforms/Utils/Utils.cpp
index 732062a8b97..879a4f4b585 100644
--- a/mlir/lib/Transforms/Utils/Utils.cpp
+++ b/mlir/lib/Transforms/Utils/Utils.cpp
@@ -362,8 +362,8 @@ void mlir::remapFunctionAttrs(
Function &fn, const DenseMap<Attribute, FunctionAttr> &remappingTable) {
// Look at all instructions in a Function.
- fn.walkOps(
- [&](OperationInst *inst) { remapFunctionAttrs(*inst, remappingTable); });
+ fn.walk(
+ [&](Instruction *inst) { remapFunctionAttrs(*inst, remappingTable); });
}
void mlir::remapFunctionAttrs(
OpenPOWER on IntegriCloud