diff options
Diffstat (limited to 'mlir/lib/Transforms/AffineLoopInvariantCodeMotion.cpp')
-rw-r--r-- | mlir/lib/Transforms/AffineLoopInvariantCodeMotion.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/mlir/lib/Transforms/AffineLoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/AffineLoopInvariantCodeMotion.cpp index f384f6d3fb1..23199dd8a39 100644 --- a/mlir/lib/Transforms/AffineLoopInvariantCodeMotion.cpp +++ b/mlir/lib/Transforms/AffineLoopInvariantCodeMotion.cpp @@ -58,15 +58,15 @@ struct LoopInvariantCodeMotion : public FunctionPass<LoopInvariantCodeMotion> { } // end anonymous namespace static bool -checkInvarianceOfNestedIfOps(Operation *op, Value *indVar, +checkInvarianceOfNestedIfOps(Operation *op, ValuePtr indVar, SmallPtrSetImpl<Operation *> &definedOps, SmallPtrSetImpl<Operation *> &opsToHoist); -static bool isOpLoopInvariant(Operation &op, Value *indVar, +static bool isOpLoopInvariant(Operation &op, ValuePtr indVar, SmallPtrSetImpl<Operation *> &definedOps, SmallPtrSetImpl<Operation *> &opsToHoist); static bool -areAllOpsInTheBlockListInvariant(Region &blockList, Value *indVar, +areAllOpsInTheBlockListInvariant(Region &blockList, ValuePtr indVar, SmallPtrSetImpl<Operation *> &definedOps, SmallPtrSetImpl<Operation *> &opsToHoist); @@ -79,7 +79,7 @@ static bool isMemRefDereferencingOp(Operation &op) { } // Returns true if the individual op is loop invariant. -bool isOpLoopInvariant(Operation &op, Value *indVar, +bool isOpLoopInvariant(Operation &op, ValuePtr indVar, SmallPtrSetImpl<Operation *> &definedOps, SmallPtrSetImpl<Operation *> &opsToHoist) { LLVM_DEBUG(llvm::dbgs() << "iterating on op: " << op;); @@ -97,9 +97,9 @@ bool isOpLoopInvariant(Operation &op, Value *indVar, return false; } else if (!isa<ConstantOp>(op)) { if (isMemRefDereferencingOp(op)) { - Value *memref = isa<AffineLoadOp>(op) - ? cast<AffineLoadOp>(op).getMemRef() - : cast<AffineStoreOp>(op).getMemRef(); + ValuePtr 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. @@ -163,7 +163,8 @@ bool isOpLoopInvariant(Operation &op, Value *indVar, // Checks if all ops in a region (i.e. list of blocks) are loop invariant. bool areAllOpsInTheBlockListInvariant( - Region &blockList, Value *indVar, SmallPtrSetImpl<Operation *> &definedOps, + Region &blockList, ValuePtr indVar, + SmallPtrSetImpl<Operation *> &definedOps, SmallPtrSetImpl<Operation *> &opsToHoist) { for (auto &b : blockList) { @@ -178,7 +179,7 @@ bool areAllOpsInTheBlockListInvariant( } // Returns true if the affine.if op can be hoisted. -bool checkInvarianceOfNestedIfOps(Operation *op, Value *indVar, +bool checkInvarianceOfNestedIfOps(Operation *op, ValuePtr indVar, SmallPtrSetImpl<Operation *> &definedOps, SmallPtrSetImpl<Operation *> &opsToHoist) { assert(isa<AffineIfOp>(op)); @@ -199,7 +200,7 @@ bool checkInvarianceOfNestedIfOps(Operation *op, Value *indVar, void LoopInvariantCodeMotion::runOnAffineForOp(AffineForOp forOp) { auto *loopBody = forOp.getBody(); - auto *indVar = forOp.getInductionVar(); + auto indVar = forOp.getInductionVar(); SmallPtrSet<Operation *, 8> definedOps; // This is the place where hoisted instructions would reside. |