diff options
Diffstat (limited to 'mlir/lib/Transforms')
| -rw-r--r-- | mlir/lib/Transforms/DialectConversion.cpp | 22 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LoopTiling.cpp | 4 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LoopUnrollAndJam.cpp | 12 | ||||
| -rw-r--r-- | mlir/lib/Transforms/Utils/LoopUtils.cpp | 26 |
4 files changed, 32 insertions, 32 deletions
diff --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp index 9848367f3c5..a621db4e183 100644 --- a/mlir/lib/Transforms/DialectConversion.cpp +++ b/mlir/lib/Transforms/DialectConversion.cpp @@ -142,7 +142,7 @@ LogicalResult impl::FunctionConversion::convertOpWithSuccessors( llvm::makeArrayRef(operands.data(), operands.data() + firstSuccessorOperand), destinations, operandsPerDestination, builder); - return LogicalResult::success(); + return success(); } LogicalResult @@ -155,11 +155,11 @@ impl::FunctionConversion::convertOp(DialectOpConversion *converter, auto results = converter->rewrite(op, operands, builder); if (results.size() != op->getNumResults()) return (op->emitError("rewriting produced a different number of results"), - LogicalResult::failure()); + failure()); for (unsigned i = 0, e = results.size(); i < e; ++i) mapping.map(op->getResult(i), results[i]); - return LogicalResult::success(); + return success(); } LogicalResult @@ -174,7 +174,7 @@ impl::FunctionConversion::convertBlock(Block *block, FuncBuilder &builder, for (Instruction &inst : *block) { if (inst.getNumBlockLists() != 0) { inst.emitError("unsupported region instruction"); - return LogicalResult::failure(); + return failure(); } // Find the first matching conversion and apply it. @@ -185,9 +185,9 @@ impl::FunctionConversion::convertBlock(Block *block, FuncBuilder &builder, if (inst.getNumSuccessors() != 0) { if (failed(convertOpWithSuccessors(conversion, &inst, builder))) - return LogicalResult::failure(); + return failure(); } else if (failed(convertOp(conversion, &inst, builder))) { - return LogicalResult::failure(); + return failure(); } converted = true; break; @@ -202,9 +202,9 @@ impl::FunctionConversion::convertBlock(Block *block, FuncBuilder &builder, if (visitedBlocks.count(succ) != 0) continue; if (failed(convertBlock(succ, builder, visitedBlocks))) - return LogicalResult::failure(); + return failure(); } - return LogicalResult::success(); + return success(); } Function *impl::FunctionConversion::convertFunction(Function *f) { @@ -267,7 +267,7 @@ LogicalResult impl::FunctionConversion::convert(DialectConversion *conversion, LogicalResult impl::FunctionConversion::run(Module *module) { if (!module) - return LogicalResult::failure(); + return failure(); MLIRContext *context = module->getContext(); conversions = dialectConversion->initConverters(context); @@ -283,7 +283,7 @@ LogicalResult impl::FunctionConversion::run(Module *module) { for (auto *func : originalFuncs) { Function *converted = convertFunction(func); if (!converted) - return LogicalResult::failure(); + return failure(); auto origFuncAttr = FunctionAttr::get(func, context); auto convertedFuncAttr = FunctionAttr::get(converted, context); @@ -305,7 +305,7 @@ LogicalResult impl::FunctionConversion::run(Module *module) { for (auto *func : convertedFuncs) module->getFunctions().push_back(func); - return LogicalResult::success(); + return success(); } // Create a function type with arguments and results converted, and argument diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp index 4178fa963d5..1a4b368c4c6 100644 --- a/mlir/lib/Transforms/LoopTiling.cpp +++ b/mlir/lib/Transforms/LoopTiling.cpp @@ -237,7 +237,7 @@ LogicalResult mlir::tileCodeGen(MutableArrayRef<OpPointer<AffineForOp>> band, if (!cst.isHyperRectangular(0, width)) { rootAffineForOp->emitError("tiled code generation unimplemented for the " "non-hyperrectangular case"); - return LogicalResult::failure(); + return failure(); } constructTiledIndexSetHyperRect(origLoops, newLoops, tileSizes); @@ -249,7 +249,7 @@ LogicalResult mlir::tileCodeGen(MutableArrayRef<OpPointer<AffineForOp>> band, // Erase the old loop nest. rootAffineForOp->erase(); - return LogicalResult::success(); + return success(); } // Identify valid and profitable bands of loops to tile. This is currently just diff --git a/mlir/lib/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Transforms/LoopUnrollAndJam.cpp index 9d160926865..6e4b932ef56 100644 --- a/mlir/lib/Transforms/LoopUnrollAndJam.cpp +++ b/mlir/lib/Transforms/LoopUnrollAndJam.cpp @@ -153,13 +153,13 @@ LogicalResult mlir::loopUnrollJamByFactor(OpPointer<AffineForOp> forOp, assert(unrollJamFactor >= 1 && "unroll jam factor should be >= 1"); if (unrollJamFactor == 1 || forOp->getBody()->empty()) - return LogicalResult::failure(); + return failure(); Optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp); if (!mayBeConstantTripCount.hasValue() && getLargestDivisorOfTripCount(forOp) % unrollJamFactor != 0) - return LogicalResult::failure(); + return failure(); auto lbMap = forOp->getLowerBoundMap(); auto ubMap = forOp->getUpperBoundMap(); @@ -169,18 +169,18 @@ LogicalResult mlir::loopUnrollJamByFactor(OpPointer<AffineForOp> forOp, // do such unrolling for a Function would be to specialize the loop for the // 'hotspot' case and unroll that hotspot. if (lbMap.getNumResults() != 1 || ubMap.getNumResults() != 1) - return LogicalResult::failure(); + return failure(); // Same operand list for lower and upper bound for now. // TODO(bondhugula): handle bounds with different sets of operands. if (!forOp->matchingBoundOperandList()) - return LogicalResult::failure(); + return failure(); // If the trip count is lower than the unroll jam factor, no unroll jam. // TODO(bondhugula): option to specify cleanup loop unrolling. if (mayBeConstantTripCount.hasValue() && mayBeConstantTripCount.getValue() < unrollJamFactor) - return LogicalResult::failure(); + return failure(); auto *forInst = forOp->getInstruction(); @@ -241,7 +241,7 @@ LogicalResult mlir::loopUnrollJamByFactor(OpPointer<AffineForOp> forOp, // Promote the loop body up if this has turned into a single iteration loop. promoteIfSingleIteration(forOp); - return LogicalResult::success(); + return success(); } static PassRegistration<LoopUnrollAndJam> pass("loop-unroll-jam", diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp index 31d4428b63a..99ea0b8033f 100644 --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -94,11 +94,11 @@ AffineMap mlir::getCleanupLoopLowerBound(ConstOpPointer<AffineForOp> forOp, LogicalResult mlir::promoteIfSingleIteration(OpPointer<AffineForOp> forOp) { Optional<uint64_t> tripCount = getConstantTripCount(forOp); if (!tripCount.hasValue() || tripCount.getValue() != 1) - return LogicalResult::failure(); + return failure(); // TODO(mlir-team): there is no builder for a max. if (forOp->getLowerBoundMap().getNumResults() != 1) - return LogicalResult::failure(); + return failure(); // Replaces all IV uses to its single iteration value. auto *iv = forOp->getInductionVar(); @@ -129,7 +129,7 @@ LogicalResult mlir::promoteIfSingleIteration(OpPointer<AffineForOp> forOp) { block->getInstructions().splice(Block::iterator(forInst), forOp->getBody()->getInstructions()); forOp->erase(); - return LogicalResult::success(); + return success(); } /// Promotes all single iteration for inst's in the Function, i.e., moves @@ -215,7 +215,7 @@ LogicalResult mlir::instBodySkew(OpPointer<AffineForOp> forOp, ArrayRef<uint64_t> shifts, bool unrollPrologueEpilogue) { if (forOp->getBody()->empty()) - return LogicalResult::success(); + return success(); // If the trip counts aren't constant, we would need versioning and // conditional guards (or context information to prevent such versioning). The @@ -224,7 +224,7 @@ LogicalResult mlir::instBodySkew(OpPointer<AffineForOp> forOp, auto mayBeConstTripCount = getConstantTripCount(forOp); if (!mayBeConstTripCount.hasValue()) { LLVM_DEBUG(forOp->emitNote("non-constant trip count loop not handled")); - return LogicalResult::success(); + return success(); } uint64_t tripCount = mayBeConstTripCount.getValue(); @@ -243,7 +243,7 @@ LogicalResult mlir::instBodySkew(OpPointer<AffineForOp> forOp, // Such large shifts are not the typical use case. if (maxShift >= numChildInsts) { forOp->emitWarning("not shifting because shifts are unrealistically large"); - return LogicalResult::success(); + return success(); } // An array of instruction groups sorted by shift amount; each group has all @@ -329,7 +329,7 @@ LogicalResult mlir::instBodySkew(OpPointer<AffineForOp> forOp, epilogue->getInstruction() != prologue->getInstruction()) loopUnrollFull(epilogue); - return LogicalResult::success(); + return success(); } /// Unrolls this loop completely. @@ -342,7 +342,7 @@ LogicalResult mlir::loopUnrollFull(OpPointer<AffineForOp> forOp) { } return loopUnrollByFactor(forOp, tripCount); } - return LogicalResult::failure(); + return failure(); } /// Unrolls and jams this loop by the specified factor or by the trip count (if @@ -367,7 +367,7 @@ LogicalResult mlir::loopUnrollByFactor(OpPointer<AffineForOp> forOp, return promoteIfSingleIteration(forOp); if (forOp->getBody()->empty()) - return LogicalResult::failure(); + return failure(); auto lbMap = forOp->getLowerBoundMap(); auto ubMap = forOp->getUpperBoundMap(); @@ -377,12 +377,12 @@ LogicalResult mlir::loopUnrollByFactor(OpPointer<AffineForOp> forOp, // do such unrolling for a Function would be to specialize the loop for the // 'hotspot' case and unroll that hotspot. if (lbMap.getNumResults() != 1 || ubMap.getNumResults() != 1) - return LogicalResult::failure(); + return failure(); // Same operand list for lower and upper bound for now. // TODO(bondhugula): handle bounds with different operand lists. if (!forOp->matchingBoundOperandList()) - return LogicalResult::failure(); + return failure(); Optional<uint64_t> mayBeConstantTripCount = getConstantTripCount(forOp); @@ -390,7 +390,7 @@ LogicalResult mlir::loopUnrollByFactor(OpPointer<AffineForOp> forOp, // TODO(bondhugula): option to specify cleanup loop unrolling. if (mayBeConstantTripCount.hasValue() && mayBeConstantTripCount.getValue() < unrollFactor) - return LogicalResult::failure(); + return failure(); // Generate the cleanup loop if trip count isn't a multiple of unrollFactor. Instruction *forInst = forOp->getInstruction(); @@ -451,7 +451,7 @@ LogicalResult mlir::loopUnrollByFactor(OpPointer<AffineForOp> forOp, // Promote the loop body up if this has turned into a single iteration loop. promoteIfSingleIteration(forOp); - return LogicalResult::success(); + return success(); } /// Performs loop interchange on 'forOpA' and 'forOpB', where 'forOpB' is |

