Skip to content

Commit

Permalink
[flang][NFC] Use tablegen to create LoopVersioning constructor (#90037)
Browse files Browse the repository at this point in the history
The pass is currently defined as only considering function arguments as
candidates for the optimization. I would prefer to generalise the pass
for other top level operations only when there is a concrete use case
before making too many assumptions about the current set of top level
operations. Therefore I have not adapted this pass to run on all top
level operations.
  • Loading branch information
tblah committed Apr 26, 2024
1 parent 24c6409 commit 08dc03c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion flang/include/flang/Optimizer/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace fir {
#define GEN_PASS_DECL_POLYMORPHICOPCONVERSION
#define GEN_PASS_DECL_OPENACCDATAOPERANDCONVERSION
#define GEN_PASS_DECL_ADDDEBUGINFO
#define GEN_PASS_DECL_LOOPVERSIONING
#include "flang/Optimizer/Transforms/Passes.h.inc"

std::unique_ptr<mlir::Pass> createAffineDemotionPass();
Expand All @@ -62,7 +63,6 @@ std::unique_ptr<mlir::Pass> createStackArraysPass();
std::unique_ptr<mlir::Pass> createAliasTagsPass();
std::unique_ptr<mlir::Pass>
createAddDebugInfoPass(fir::AddDebugInfoOptions options = {});
std::unique_ptr<mlir::Pass> createLoopVersioningPass();

std::unique_ptr<mlir::Pass>
createMemoryAllocationPass(bool dynOnHeap, std::size_t maxStackSize);
Expand Down
1 change: 0 additions & 1 deletion flang/include/flang/Optimizer/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ def LoopVersioning : Pass<"loop-versioning", "mlir::func::FuncOp"> {
an array has element sized stride. The element sizes stride allows some
loops to be vectorized as well as other loop optimizations.
}];
let constructor = "::fir::createLoopVersioningPass()";
let dependentDialects = [ "fir::FIROpsDialect" ];
}

Expand Down
2 changes: 1 addition & 1 deletion flang/include/flang/Tools/CLOptions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ inline void createDefaultFIROptimizerPassPipeline(
}

if (pc.LoopVersioning)
pm.addPass(fir::createLoopVersioningPass());
pm.addPass(fir::createLoopVersioning());

pm.addPass(mlir::createCSEPass());

Expand Down
4 changes: 0 additions & 4 deletions flang/lib/Optimizer/Transforms/LoopVersioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,3 @@ void LoopVersioningPass::runOnOperation() {

LLVM_DEBUG(llvm::dbgs() << "=== End " DEBUG_TYPE " ===\n");
}

std::unique_ptr<mlir::Pass> fir::createLoopVersioningPass() {
return std::make_unique<LoopVersioningPass>();
}

0 comments on commit 08dc03c

Please sign in to comment.