diff options
| author | River Riddle <riverriddle@google.com> | 2019-02-28 14:50:42 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 16:50:44 -0700 |
| commit | ed5fe2098be12d839cb4384e59a93f15f6f42e58 (patch) | |
| tree | cf8d1cce87c0aff6af00fd90f0f42ff9f44e3212 /mlir/lib/Transforms | |
| parent | 58889884a254894342b589309064782be64c3afd (diff) | |
| download | bcm5719-llvm-ed5fe2098be12d839cb4384e59a93f15f6f42e58.tar.gz bcm5719-llvm-ed5fe2098be12d839cb4384e59a93f15f6f42e58.zip | |
Remove PassResult and have the runOnFunction/runOnModule functions return void instead. To signal a pass failure, passes should now invoke the 'signalPassFailure' method. This provides the equivalent functionality when needed, but isn't an intrusive part of the API like PassResult.
PiperOrigin-RevId: 236202029
Diffstat (limited to 'mlir/lib/Transforms')
| -rw-r--r-- | mlir/lib/Transforms/CSE.cpp | 6 | ||||
| -rw-r--r-- | mlir/lib/Transforms/Canonicalizer.cpp | 5 | ||||
| -rw-r--r-- | mlir/lib/Transforms/ConstantFold.cpp | 6 | ||||
| -rw-r--r-- | mlir/lib/Transforms/DmaGeneration.cpp | 9 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LoopFusion.cpp | 5 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LoopTiling.cpp | 10 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LoopUnroll.cpp | 7 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LoopUnrollAndJam.cpp | 6 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LowerAffine.cpp | 12 | ||||
| -rw-r--r-- | mlir/lib/Transforms/LowerVectorTransfers.cpp | 3 | ||||
| -rw-r--r-- | mlir/lib/Transforms/MaterializeVectors.cpp | 10 | ||||
| -rw-r--r-- | mlir/lib/Transforms/MemRefDataFlowOpt.cpp | 9 | ||||
| -rw-r--r-- | mlir/lib/Transforms/PipelineDataTransfer.cpp | 30 | ||||
| -rw-r--r-- | mlir/lib/Transforms/SimplifyAffineStructures.cpp | 6 | ||||
| -rw-r--r-- | mlir/lib/Transforms/StripDebugInfo.cpp | 5 | ||||
| -rw-r--r-- | mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp | 7 | ||||
| -rw-r--r-- | mlir/lib/Transforms/Vectorize.cpp | 5 | ||||
| -rw-r--r-- | mlir/lib/Transforms/ViewFunctionGraph.cpp | 3 |
18 files changed, 56 insertions, 88 deletions
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp index 24b53220613..f4b51c3edd7 100644 --- a/mlir/lib/Transforms/CSE.cpp +++ b/mlir/lib/Transforms/CSE.cpp @@ -111,7 +111,7 @@ struct CSE : public FunctionPass<CSE> { void simplifyBlock(DominanceInfo &domInfo, Block *bb); void simplifyBlockList(DominanceInfo &domInfo, BlockList &blockList); - PassResult runOnFunction() override; + void runOnFunction() override; private: /// A scoped hash table of defining operations within a function. @@ -216,7 +216,7 @@ void CSE::simplifyBlockList(DominanceInfo &domInfo, BlockList &blockList) { } } -PassResult CSE::runOnFunction() { +void CSE::runOnFunction() { DominanceInfo domInfo(&getFunction()); simplifyBlockList(domInfo, getFunction().getBlockList()); @@ -224,8 +224,6 @@ PassResult CSE::runOnFunction() { for (auto *op : opsToErase) op->erase(); opsToErase.clear(); - - return success(); } FunctionPassBase *mlir::createCSEPass() { return new CSE(); } diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp index 764f055a673..17259bb19da 100644 --- a/mlir/lib/Transforms/Canonicalizer.cpp +++ b/mlir/lib/Transforms/Canonicalizer.cpp @@ -34,11 +34,11 @@ namespace { /// Canonicalize operations in functions. struct Canonicalizer : public FunctionPass<Canonicalizer> { - PassResult runOnFunction() override; + void runOnFunction() override; }; } // end anonymous namespace -PassResult Canonicalizer::runOnFunction() { +void Canonicalizer::runOnFunction() { OwningRewritePatternList patterns; auto &func = getFunction(); @@ -50,7 +50,6 @@ PassResult Canonicalizer::runOnFunction() { op->getCanonicalizationPatterns(patterns, context); applyPatternsGreedily(&func, std::move(patterns)); - return success(); } /// Create a Canonicalizer pass. diff --git a/mlir/lib/Transforms/ConstantFold.cpp b/mlir/lib/Transforms/ConstantFold.cpp index ed35c03755f..6274d7dc857 100644 --- a/mlir/lib/Transforms/ConstantFold.cpp +++ b/mlir/lib/Transforms/ConstantFold.cpp @@ -33,7 +33,7 @@ struct ConstantFold : public FunctionPass<ConstantFold> { std::vector<Instruction *> opInstsToErase; void foldInstruction(Instruction *op); - PassResult runOnFunction() override; + void runOnFunction() override; }; } // end anonymous namespace @@ -92,7 +92,7 @@ void ConstantFold::foldInstruction(Instruction *op) { // For now, we do a simple top-down pass over a function folding constants. We // don't handle conditional control flow, block arguments, folding // conditional branches, or anything else fancy. -PassResult ConstantFold::runOnFunction() { +void ConstantFold::runOnFunction() { existingConstants.clear(); opInstsToErase.clear(); @@ -113,8 +113,6 @@ PassResult ConstantFold::runOnFunction() { if (cst->use_empty()) cst->getDefiningInst()->erase(); } - - return success(); } /// Creates a constant folding pass. diff --git a/mlir/lib/Transforms/DmaGeneration.cpp b/mlir/lib/Transforms/DmaGeneration.cpp index 82ba07acb5f..53bc56173d2 100644 --- a/mlir/lib/Transforms/DmaGeneration.cpp +++ b/mlir/lib/Transforms/DmaGeneration.cpp @@ -84,7 +84,7 @@ struct DmaGeneration : public FunctionPass<DmaGeneration> { minDmaTransferSize(minDmaTransferSize), fastMemCapacityBytes(fastMemCapacityBytes) {} - PassResult runOnFunction() override; + void runOnFunction() override; bool runOnBlock(Block *block); uint64_t runOnBlock(Block::iterator begin, Block::iterator end); @@ -754,16 +754,13 @@ uint64_t DmaGeneration::runOnBlock(Block::iterator begin, Block::iterator end) { return totalDmaBuffersSizeInBytes; } -PassResult DmaGeneration::runOnFunction() { +void DmaGeneration::runOnFunction() { Function *f = &getFunction(); FuncBuilder topBuilder(f); zeroIndex = topBuilder.create<ConstantIndexOp>(f->getLoc(), 0); - for (auto &block : *f) { + for (auto &block : *f) runOnBlock(&block); - } - // This function never leaves the IR in an invalid state. - return success(); } static PassRegistration<DmaGeneration> diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp index 1528e394506..61d13325d13 100644 --- a/mlir/lib/Transforms/LoopFusion.cpp +++ b/mlir/lib/Transforms/LoopFusion.cpp @@ -91,7 +91,7 @@ struct LoopFusion : public FunctionPass<LoopFusion> { : localBufSizeThreshold(localBufSizeThreshold), fastMemorySpace(fastMemorySpace) {} - PassResult runOnFunction() override; + void runOnFunction() override; // Any local buffers smaller than this size (in bytes) will be created in // `fastMemorySpace` if provided. @@ -1800,7 +1800,7 @@ public: } // end anonymous namespace -PassResult LoopFusion::runOnFunction() { +void LoopFusion::runOnFunction() { // Override if a command line argument was provided. if (clFusionFastMemorySpace.getNumOccurrences() > 0) { fastMemorySpace = clFusionFastMemorySpace.getValue(); @@ -1814,7 +1814,6 @@ PassResult LoopFusion::runOnFunction() { MemRefDependenceGraph g; if (g.init(&getFunction())) GreedyFusion(&g).run(localBufSizeThreshold, fastMemorySpace); - return success(); } static PassRegistration<LoopFusion> pass("loop-fusion", "Fuse loop nests"); diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp index db0e8d51ad8..4aebbc2e856 100644 --- a/mlir/lib/Transforms/LoopTiling.cpp +++ b/mlir/lib/Transforms/LoopTiling.cpp @@ -48,7 +48,7 @@ namespace { /// A pass to perform loop tiling on all suitable loop nests of a Function. struct LoopTiling : public FunctionPass<LoopTiling> { - PassResult runOnFunction() override; + void runOnFunction() override; constexpr static unsigned kDefaultTileSize = 4; }; @@ -253,7 +253,7 @@ getTileableBands(Function *f, getMaximalPerfectLoopNest(forOp); } -PassResult LoopTiling::runOnFunction() { +void LoopTiling::runOnFunction() { std::vector<SmallVector<OpPointer<AffineForOp>, 6>> bands; getTileableBands(&getFunction(), &bands); @@ -265,11 +265,9 @@ PassResult LoopTiling::runOnFunction() { clTileSizes.begin() + std::min(clTileSizes.size(), band.size()), tileSizes.begin()); - if (tileCodeGen(band, tileSizes)) { - return failure(); - } + if (tileCodeGen(band, tileSizes)) + return signalPassFailure(); } - return success(); } static PassRegistration<LoopTiling> pass("loop-tile", "Tile loop nests"); diff --git a/mlir/lib/Transforms/LoopUnroll.cpp b/mlir/lib/Transforms/LoopUnroll.cpp index 231dba65720..2bf78ae258e 100644 --- a/mlir/lib/Transforms/LoopUnroll.cpp +++ b/mlir/lib/Transforms/LoopUnroll.cpp @@ -79,7 +79,7 @@ struct LoopUnroll : public FunctionPass<LoopUnroll> { : unrollFactor(unrollFactor), unrollFull(unrollFull), getUnrollFactor(getUnrollFactor) {} - PassResult runOnFunction() override; + void runOnFunction() override; /// Unroll this for inst. Returns false if nothing was done. bool runOnAffineForOp(OpPointer<AffineForOp> forOp); @@ -88,7 +88,7 @@ struct LoopUnroll : public FunctionPass<LoopUnroll> { }; } // end anonymous namespace -PassResult LoopUnroll::runOnFunction() { +void LoopUnroll::runOnFunction() { // Gathers all innermost loops through a post order pruned walk. struct InnermostLoopGatherer { // Store innermost loops as we walk. @@ -137,7 +137,7 @@ PassResult LoopUnroll::runOnFunction() { }); for (auto forOp : loops) loopUnrollFull(forOp); - return success(); + return; } unsigned numRepetitions = clUnrollNumRepetitions.getNumOccurrences() > 0 @@ -158,7 +158,6 @@ PassResult LoopUnroll::runOnFunction() { // Break out if nothing was unrolled. break; } - return success(); } /// Unrolls a 'for' inst. Returns true if the loop was unrolled, false diff --git a/mlir/lib/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Transforms/LoopUnrollAndJam.cpp index e950d117ddc..87259497cef 100644 --- a/mlir/lib/Transforms/LoopUnrollAndJam.cpp +++ b/mlir/lib/Transforms/LoopUnrollAndJam.cpp @@ -78,7 +78,7 @@ struct LoopUnrollAndJam : public FunctionPass<LoopUnrollAndJam> { explicit LoopUnrollAndJam(Optional<unsigned> unrollJamFactor = None) : unrollJamFactor(unrollJamFactor) {} - PassResult runOnFunction() override; + void runOnFunction() override; bool runOnAffineForOp(OpPointer<AffineForOp> forOp); }; } // end anonymous namespace @@ -88,15 +88,13 @@ FunctionPassBase *mlir::createLoopUnrollAndJamPass(int unrollJamFactor) { unrollJamFactor == -1 ? None : Optional<unsigned>(unrollJamFactor)); } -PassResult LoopUnrollAndJam::runOnFunction() { +void LoopUnrollAndJam::runOnFunction() { // Currently, just the outermost loop from the first loop nest is // unroll-and-jammed by this pass. However, runOnAffineForOp can be called on // any for operation. auto &entryBlock = getFunction().front(); if (auto forOp = entryBlock.front().dyn_cast<AffineForOp>()) runOnAffineForOp(forOp); - - return success(); } /// Unroll and jam a 'for' inst. Default unroll jam factor is diff --git a/mlir/lib/Transforms/LowerAffine.cpp b/mlir/lib/Transforms/LowerAffine.cpp index aecd4314d42..1070c10a2d4 100644 --- a/mlir/lib/Transforms/LowerAffine.cpp +++ b/mlir/lib/Transforms/LowerAffine.cpp @@ -243,7 +243,7 @@ Optional<SmallVector<Value *, 8>> static expandAffineMap( namespace { struct LowerAffinePass : public FunctionPass<LowerAffinePass> { - PassResult runOnFunction() override; + void runOnFunction() override; bool lowerAffineFor(OpPointer<AffineForOp> forOp); bool lowerAffineIf(AffineIfOp *ifOp); @@ -604,7 +604,7 @@ bool LowerAffinePass::lowerAffineApply(AffineApplyOp *op) { // construction. When an Value is used, it gets replaced with the // corresponding Value that has been defined previously. The value flow // starts with function arguments converted to basic block arguments. -PassResult LowerAffinePass::runOnFunction() { +void LowerAffinePass::runOnFunction() { SmallVector<Instruction *, 8> instsToRewrite; // Collect all the For instructions as well as AffineIfOps and AffineApplyOps. @@ -620,16 +620,14 @@ PassResult LowerAffinePass::runOnFunction() { for (auto *inst : instsToRewrite) { if (auto ifOp = inst->dyn_cast<AffineIfOp>()) { if (lowerAffineIf(ifOp)) - return failure(); + return signalPassFailure(); } else if (auto forOp = inst->dyn_cast<AffineForOp>()) { if (lowerAffineFor(forOp)) - return failure(); + return signalPassFailure(); } else if (lowerAffineApply(inst->cast<AffineApplyOp>())) { - return failure(); + return signalPassFailure(); } } - - return success(); } /// Lowers If and For instructions within a function into their lower level CFG diff --git a/mlir/lib/Transforms/LowerVectorTransfers.cpp b/mlir/lib/Transforms/LowerVectorTransfers.cpp index ddeb524f5ab..261c360631f 100644 --- a/mlir/lib/Transforms/LowerVectorTransfers.cpp +++ b/mlir/lib/Transforms/LowerVectorTransfers.cpp @@ -426,11 +426,10 @@ public: struct LowerVectorTransfersPass : public FunctionPass<LowerVectorTransfersPass> { - PassResult runOnFunction() { + void runOnFunction() { Function *f = &getFunction(); applyMLPatternsGreedily<VectorTransferExpander<VectorTransferReadOp>, VectorTransferExpander<VectorTransferWriteOp>>(f); - return success(); } // Thread-safe RAII context with local scope. BumpPtrAllocator freed on exit. diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp index 7b45af011ab..c41c75bb88f 100644 --- a/mlir/lib/Transforms/MaterializeVectors.cpp +++ b/mlir/lib/Transforms/MaterializeVectors.cpp @@ -197,7 +197,7 @@ struct MaterializationState { }; struct MaterializeVectorsPass : public FunctionPass<MaterializeVectorsPass> { - PassResult runOnFunction() override; + void runOnFunction() override; }; } // end anonymous namespace @@ -729,14 +729,14 @@ static bool materialize(Function *f, return false; } -PassResult MaterializeVectorsPass::runOnFunction() { +void MaterializeVectorsPass::runOnFunction() { // Thread-safe RAII local context, BumpPtrAllocator freed on exit. NestedPatternContext mlContext; // TODO(ntv): Check to see if this supports arbitrary top-level code. Function *f = &getFunction(); if (f->getBlocks().size() != 1) - return success(); + return; using matcher::Op; LLVM_DEBUG(dbgs() << "\nMaterializeVectors on Function\n"); @@ -764,8 +764,8 @@ PassResult MaterializeVectorsPass::runOnFunction() { terminators.insert(m.getMatchedInstruction()); } - auto fail = materialize(f, terminators, &state); - return fail ? PassResult::Failure : PassResult::Success; + if (materialize(f, terminators, &state)) + signalPassFailure(); } FunctionPassBase *mlir::createMaterializeVectorsPass() { diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp index 067bfa4c94c..55837f95d14 100644 --- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp +++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp @@ -70,7 +70,7 @@ namespace { // than dealloc) remain. // struct MemRefDataFlowOpt : public FunctionPass<MemRefDataFlowOpt> { - PassResult runOnFunction() override; + void runOnFunction() override; void forwardStoreToLoad(OpPointer<LoadOp> loadOp); @@ -209,11 +209,11 @@ void MemRefDataFlowOpt::forwardStoreToLoad(OpPointer<LoadOp> loadOp) { loadOpsToErase.push_back(loadOpInst); } -PassResult MemRefDataFlowOpt::runOnFunction() { +void MemRefDataFlowOpt::runOnFunction() { // Only supports single block functions at the moment. Function &f = getFunction(); if (f.getBlocks().size() != 1) - return success(); + return; DominanceInfo theDomInfo(&f); domInfo = &theDomInfo; @@ -254,9 +254,6 @@ PassResult MemRefDataFlowOpt::runOnFunction() { use.getOwner()->erase(); defInst->erase(); } - - // This function never leaves the IR in an invalid state. - return success(); } static PassRegistration<MemRefDataFlowOpt> diff --git a/mlir/lib/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Transforms/PipelineDataTransfer.cpp index 19d31fd9f26..9df1af9767f 100644 --- a/mlir/lib/Transforms/PipelineDataTransfer.cpp +++ b/mlir/lib/Transforms/PipelineDataTransfer.cpp @@ -39,8 +39,8 @@ using namespace mlir; namespace { struct PipelineDataTransfer : public FunctionPass<PipelineDataTransfer> { - PassResult runOnFunction() override; - PassResult runOnAffineForOp(OpPointer<AffineForOp> forOp); + void runOnFunction() override; + void runOnAffineForOp(OpPointer<AffineForOp> forOp); std::vector<OpPointer<AffineForOp>> forOps; }; @@ -139,7 +139,7 @@ static bool doubleBuffer(Value *oldMemRef, OpPointer<AffineForOp> forOp) { } /// Returns success if the IR is in a valid state. -PassResult PipelineDataTransfer::runOnFunction() { +void PipelineDataTransfer::runOnFunction() { // Do a post order walk so that inner loop DMAs are processed first. This is // necessary since 'for' instructions nested within would otherwise become // invalid (erased) when the outer loop is pipelined (the pipelined one gets @@ -148,11 +148,8 @@ PassResult PipelineDataTransfer::runOnFunction() { forOps.clear(); getFunction().walkPostOrder<AffineForOp>( [&](OpPointer<AffineForOp> forOp) { forOps.push_back(forOp); }); - bool ret = false; - for (auto forOp : forOps) { - ret = ret | runOnAffineForOp(forOp); - } - return ret ? failure() : success(); + for (auto forOp : forOps) + runOnAffineForOp(forOp); } // Check if tags of the dma start op and dma wait op match. @@ -252,13 +249,12 @@ static void findMatchingStartFinishInsts( /// Overlap DMA transfers with computation in this loop. If successful, /// 'forOp' is deleted, and a prologue, a new pipelined loop, and epilogue are /// inserted right before where it was. -PassResult -PipelineDataTransfer::runOnAffineForOp(OpPointer<AffineForOp> forOp) { +void PipelineDataTransfer::runOnAffineForOp(OpPointer<AffineForOp> forOp) { auto mayBeConstTripCount = getConstantTripCount(forOp); if (!mayBeConstTripCount.hasValue()) { LLVM_DEBUG( forOp->emitNote("won't pipeline due to unknown trip count loop")); - return success(); + return; } SmallVector<std::pair<Instruction *, Instruction *>, 4> startWaitPairs; @@ -266,7 +262,7 @@ PipelineDataTransfer::runOnAffineForOp(OpPointer<AffineForOp> forOp) { if (startWaitPairs.empty()) { LLVM_DEBUG(forOp->emitNote("No dma start/finish pairs\n")); - return success(); + return; } // Double the buffers for the higher memory space memref's. @@ -287,7 +283,7 @@ PipelineDataTransfer::runOnAffineForOp(OpPointer<AffineForOp> forOp) { LLVM_DEBUG(llvm::dbgs() << "double buffering failed for: \n";); LLVM_DEBUG(dmaStartInst->dump()); // IR still in a valid state. - return success(); + return; } // If the old memref has no more uses, remove its 'dead' alloc if it was // alloc'ed. (note: DMA buffers are rarely function live-in; but a 'dim' @@ -315,7 +311,7 @@ PipelineDataTransfer::runOnAffineForOp(OpPointer<AffineForOp> forOp) { dmaFinishInst->getOperand(getTagMemRefPos(*dmaFinishInst)); if (!doubleBuffer(oldTagMemRef, forOp)) { LLVM_DEBUG(llvm::dbgs() << "tag double buffering failed\n";); - return success(); + return; } // If the old tag has no more uses, remove its 'dead' alloc if it was // alloc'ed. @@ -377,15 +373,13 @@ PipelineDataTransfer::runOnAffineForOp(OpPointer<AffineForOp> forOp) { if (!isInstwiseShiftValid(forOp, shifts)) { // Violates dependences. LLVM_DEBUG(llvm::dbgs() << "Shifts invalid - unexpected\n";); - return success(); + return; } if (instBodySkew(forOp, shifts)) { LLVM_DEBUG(llvm::dbgs() << "inst body skewing failed - unexpected\n";); - return success(); + return; } - - return success(); } static PassRegistration<PipelineDataTransfer> pass( diff --git a/mlir/lib/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Transforms/SimplifyAffineStructures.cpp index 4c0fed5b648..3adcbe038ea 100644 --- a/mlir/lib/Transforms/SimplifyAffineStructures.cpp +++ b/mlir/lib/Transforms/SimplifyAffineStructures.cpp @@ -38,7 +38,7 @@ namespace { /// on AffineMap and driven from the existing canonicalization pass. struct SimplifyAffineStructures : public FunctionPass<SimplifyAffineStructures> { - PassResult runOnFunction() override; + void runOnFunction() override; }; } // end anonymous namespace @@ -57,7 +57,7 @@ static IntegerSet simplifyIntegerSet(IntegerSet set) { return set; } -PassResult SimplifyAffineStructures::runOnFunction() { +void SimplifyAffineStructures::runOnFunction() { getFunction().walk([&](Instruction *opInst) { for (auto attr : opInst->getAttrs()) { if (auto mapAttr = attr.second.dyn_cast<AffineMapAttr>()) { @@ -71,8 +71,6 @@ PassResult SimplifyAffineStructures::runOnFunction() { } } }); - - return success(); } static PassRegistration<SimplifyAffineStructures> diff --git a/mlir/lib/Transforms/StripDebugInfo.cpp b/mlir/lib/Transforms/StripDebugInfo.cpp index 0f1ba02174b..47244f94ac9 100644 --- a/mlir/lib/Transforms/StripDebugInfo.cpp +++ b/mlir/lib/Transforms/StripDebugInfo.cpp @@ -24,18 +24,17 @@ using namespace mlir; namespace { struct StripDebugInfo : public FunctionPass<StripDebugInfo> { - PassResult runOnFunction() override; + void runOnFunction() override; }; } // end anonymous namespace -PassResult StripDebugInfo::runOnFunction() { +void StripDebugInfo::runOnFunction() { Function &func = getFunction(); UnknownLoc unknownLoc = UnknownLoc::get(func.getContext()); // Strip the debug info from the function and its instructions. func.setLoc(unknownLoc); func.walk([&](Instruction *inst) { inst->setLoc(unknownLoc); }); - return success(); } /// Creates a pass to strip debug information from a function. diff --git a/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp b/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp index 60e58c42e6b..c254790dbe7 100644 --- a/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp +++ b/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp @@ -87,7 +87,7 @@ struct VectorizerTestPass : public FunctionPass<VectorizerTestPass> { static constexpr auto kTestAffineMapOpName = "test_affine_map"; static constexpr auto kTestAffineMapAttrName = "affine_map"; - PassResult runOnFunction() override; + void runOnFunction() override; void testVectorShapeRatio(Function *f); void testForwardSlicing(Function *f); void testBackwardSlicing(Function *f); @@ -260,14 +260,14 @@ void VectorizerTestPass::testNormalizeMaps(Function *f) { } } -PassResult VectorizerTestPass::runOnFunction() { +void VectorizerTestPass::runOnFunction() { // Thread-safe RAII local context, BumpPtrAllocator freed on exit. NestedPatternContext mlContext; // Only support single block functions at this point. Function *f = &getFunction(); if (f->getBlocks().size() != 1) - return success(); + return; if (!clTestVectorShapeRatio.empty()) { testVectorShapeRatio(f); @@ -287,7 +287,6 @@ PassResult VectorizerTestPass::runOnFunction() { if (clTestNormalizeMaps) { testNormalizeMaps(f); } - return PassResult::Success; } FunctionPassBase *mlir::createVectorizerTestPass() { diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp index 8a378a29c84..50c6cdad0f9 100644 --- a/mlir/lib/Transforms/Vectorize.cpp +++ b/mlir/lib/Transforms/Vectorize.cpp @@ -652,7 +652,7 @@ static std::vector<NestedPattern> makePatterns() { namespace { struct Vectorize : public FunctionPass<Vectorize> { - PassResult runOnFunction() override; + void runOnFunction() override; }; } // end anonymous namespace @@ -1260,7 +1260,7 @@ static bool vectorizeRootMatch(NestedMatch m, VectorizationStrategy *strategy) { /// Applies vectorization to the current Function by searching over a bunch of /// predetermined patterns. -PassResult Vectorize::runOnFunction() { +void Vectorize::runOnFunction() { // Thread-safe RAII local context, BumpPtrAllocator freed on exit. NestedPatternContext mlContext; @@ -1295,7 +1295,6 @@ PassResult Vectorize::runOnFunction() { } } LLVM_DEBUG(dbgs() << "\n"); - return PassResult::Success; } FunctionPassBase *mlir::createVectorizePass() { return new Vectorize(); } diff --git a/mlir/lib/Transforms/ViewFunctionGraph.cpp b/mlir/lib/Transforms/ViewFunctionGraph.cpp index 30fae94139f..b2dfe6795b6 100644 --- a/mlir/lib/Transforms/ViewFunctionGraph.cpp +++ b/mlir/lib/Transforms/ViewFunctionGraph.cpp @@ -77,9 +77,8 @@ struct PrintCFGPass : public FunctionPass<PrintCFGPass> { PrintCFGPass(llvm::raw_ostream &os = llvm::errs(), bool shortNames = false, const llvm::Twine &title = "") : os(os), shortNames(shortNames), title(title) {} - PassResult runOnFunction() { + void runOnFunction() { mlir::writeGraph(os, &getFunction(), shortNames, title); - return success(); } private: |

