summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
diff options
context:
space:
mode:
authorAndy Davis <andydavis@google.com>2019-07-03 10:35:03 -0700
committerjpienaar <jpienaar@google.com>2019-07-03 14:37:06 -0700
commit2e1187dd25aee1c364e5273108c14e591656f19a (patch)
tree4e2dc97ddd1b895b224c71d5f5ede03327fa44a1 /mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
parent28fb74379868b7af72ec711f23416014e6d52348 (diff)
downloadbcm5719-llvm-2e1187dd25aee1c364e5273108c14e591656f19a.tar.gz
bcm5719-llvm-2e1187dd25aee1c364e5273108c14e591656f19a.zip
Globally change load/store/dma_start/dma_wait operations over to affine.load/store/dma_start/dma_wait.
In most places, this is just a name change (with the exception of affine.dma_start swapping the operand positions of its tag memref and num_elements operands). Significant code changes occur here: *) Vectorization: LoopAnalysis.cpp, Vectorize.cpp *) Affine Transforms: Transforms/Utils/Utils.cpp PiperOrigin-RevId: 256395088
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
-rw-r--r--mlir/lib/Transforms/LoopInvariantCodeMotion.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
index c4c1184fa82..48e97f44436 100644
--- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
@@ -70,7 +70,7 @@ areAllOpsInTheBlockListInvariant(Region &blockList, Value *indVar,
static bool isMemRefDereferencingOp(Operation &op) {
// TODO(asabne): Support DMA Ops.
- if (isa<LoadOp>(op) || isa<StoreOp>(op)) {
+ if (isa<AffineLoadOp>(op) || isa<AffineStoreOp>(op)) {
return true;
}
return false;
@@ -94,23 +94,25 @@ bool isOpLoopInvariant(Operation &op, Value *indVar,
// If the body of a predicated region has a for loop, we don't hoist the
// 'affine.if'.
return false;
- } else if (isa<DmaStartOp>(op) || isa<DmaWaitOp>(op)) {
+ } else if (isa<AffineDmaStartOp>(op) || isa<AffineDmaWaitOp>(op)) {
// TODO(asabne): Support DMA ops.
return false;
} else if (!isa<ConstantOp>(op)) {
if (isMemRefDereferencingOp(op)) {
- Value *memref = isa<LoadOp>(op) ? cast<LoadOp>(op).getMemRef()
- : cast<StoreOp>(op).getMemRef();
+ Value *memref = isa<AffineLoadOp>(op)
+ ? cast<AffineLoadOp>(op).getMemRef()
+ : cast<AffineStoreOp>(op).getMemRef();
for (auto *user : memref->getUsers()) {
// If this memref has a user that is a DMA, give up because these
// operations write to this memref.
- if (isa<DmaStartOp>(op) || isa<DmaWaitOp>(op)) {
+ if (isa<AffineDmaStartOp>(op) || isa<AffineDmaWaitOp>(op)) {
return false;
}
// If the memref used by the load/store is used in a store elsewhere in
// the loop nest, we do not hoist. Similarly, if the memref used in a
// load is also being stored too, we do not hoist the load.
- if (isa<StoreOp>(user) || (isa<LoadOp>(user) && isa<StoreOp>(op))) {
+ if (isa<AffineStoreOp>(user) ||
+ (isa<AffineLoadOp>(user) && isa<AffineStoreOp>(op))) {
if (&op != user) {
SmallVector<AffineForOp, 8> userIVs;
getLoopIVs(*user, &userIVs);
OpenPOWER on IntegriCloud