diff options
| author | River Riddle <riverriddle@google.com> | 2019-03-27 14:02:02 -0700 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 17:47:26 -0700 |
| commit | 99b87c9707b389183de33961f81d4b2730b033c8 (patch) | |
| tree | 028b9ca91407a819726ed7a3aa8a07f975f4de5c /mlir/lib/Transforms/MemRefDataFlowOpt.cpp | |
| parent | 3518122e86c864276da532c15610c86bc57c0a56 (diff) | |
| download | bcm5719-llvm-99b87c9707b389183de33961f81d4b2730b033c8.tar.gz bcm5719-llvm-99b87c9707b389183de33961f81d4b2730b033c8.zip | |
Replace usages of Instruction with Operation in the Transforms/ directory.
PiperOrigin-RevId: 240636130
Diffstat (limited to 'mlir/lib/Transforms/MemRefDataFlowOpt.cpp')
| -rw-r--r-- | mlir/lib/Transforms/MemRefDataFlowOpt.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp index 9779ab78a3f..a579d439368 100644 --- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp +++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp @@ -54,8 +54,8 @@ namespace { // iteration of the innermost loop enclosing both the store op and the load op. // // (* A dependence being satisfied at a block: a dependence that is satisfied by -// virtue of the destination instruction appearing textually / lexically after -// the source instruction within the body of a 'affine.for' instruction; thus, a +// virtue of the destination operation appearing textually / lexically after +// the source operation within the body of a 'affine.for' operation; thus, a // dependence is always either satisfied by a loop or by a block). // // The above conditions are simple to check, sufficient, and powerful for most @@ -77,7 +77,7 @@ struct MemRefDataFlowOpt : public FunctionPass<MemRefDataFlowOpt> { // A list of memref's that are potentially dead / could be eliminated. SmallPtrSet<Value *, 4> memrefsToErase; // Load op's whose results were replaced by those forwarded from stores. - std::vector<Instruction *> loadOpsToErase; + std::vector<Operation *> loadOpsToErase; DominanceInfo *domInfo = nullptr; PostDominanceInfo *postDomInfo = nullptr; @@ -94,13 +94,13 @@ FunctionPassBase *mlir::createMemRefDataFlowOptPass() { // This is a straightforward implementation not optimized for speed. Optimize // this in the future if needed. void MemRefDataFlowOpt::forwardStoreToLoad(LoadOp loadOp) { - Instruction *lastWriteStoreOp = nullptr; - Instruction *loadOpInst = loadOp.getOperation(); + Operation *lastWriteStoreOp = nullptr; + Operation *loadOpInst = loadOp.getOperation(); // First pass over the use list to get minimum number of surrounding // loops common between the load op and the store op, with min taken across // all store ops. - SmallVector<Instruction *, 8> storeOps; + SmallVector<Operation *, 8> storeOps; unsigned minSurroundingLoops = getNestingDepth(*loadOpInst); for (InstOperand &use : loadOp.getMemRef()->getUses()) { auto storeOp = use.getOwner()->dyn_cast<StoreOp>(); @@ -119,11 +119,11 @@ void MemRefDataFlowOpt::forwardStoreToLoad(LoadOp loadOp) { // and loadOp. // The list of store op candidates for forwarding - need to satisfy the // conditions listed at the top. - SmallVector<Instruction *, 8> fwdingCandidates; + SmallVector<Operation *, 8> fwdingCandidates; // Store ops that have a dependence into the load (even if they aren't // forwarding candidates). Each forwarding candidate will be checked for a // post-dominance on these. 'fwdingCandidates' are a subset of depSrcStores. - SmallVector<Instruction *, 8> depSrcStores; + SmallVector<Operation *, 8> depSrcStores; for (auto *storeOpInst : storeOps) { MemRefAccess srcAccess(storeOpInst); MemRefAccess destAccess(loadOpInst); @@ -186,7 +186,7 @@ void MemRefDataFlowOpt::forwardStoreToLoad(LoadOp loadOp) { // that postdominates all 'depSrcStores' (if such a store exists) is the // unique store providing the value to the load, i.e., provably the last // writer to that memref loc. - if (llvm::all_of(depSrcStores, [&](Instruction *depStore) { + if (llvm::all_of(depSrcStores, [&](Operation *depStore) { return postDomInfo->postDominates(storeOpInst, depStore); })) { lastWriteStoreOp = storeOpInst; @@ -236,9 +236,9 @@ void MemRefDataFlowOpt::runOnFunction() { // to do this as well, but we'll do it here since we collected these anyway. for (auto *memref : memrefsToErase) { // If the memref hasn't been alloc'ed in this function, skip. - Instruction *defInst = memref->getDefiningOp(); + Operation *defInst = memref->getDefiningOp(); if (!defInst || !defInst->isa<AllocOp>()) - // TODO(mlir-team): if the memref was returned by a 'call' instruction, we + // TODO(mlir-team): if the memref was returned by a 'call' operation, we // could still erase it if the call had no side-effects. continue; if (std::any_of(memref->use_begin(), memref->use_end(), |

