Skip to content

Commit 08dc03c

Browse files
authored
[flang][NFC] Use tablegen to create LoopVersioning constructor (llvm#90037)
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.
1 parent 24c6409 commit 08dc03c

File tree

4 files changed

+2
-7
lines changed

4 files changed

+2
-7
lines changed

flang/include/flang/Optimizer/Transforms/Passes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace fir {
4747
#define GEN_PASS_DECL_POLYMORPHICOPCONVERSION
4848
#define GEN_PASS_DECL_OPENACCDATAOPERANDCONVERSION
4949
#define GEN_PASS_DECL_ADDDEBUGINFO
50+
#define GEN_PASS_DECL_LOOPVERSIONING
5051
#include "flang/Optimizer/Transforms/Passes.h.inc"
5152

5253
std::unique_ptr<mlir::Pass> createAffineDemotionPass();
@@ -62,7 +63,6 @@ std::unique_ptr<mlir::Pass> createStackArraysPass();
6263
std::unique_ptr<mlir::Pass> createAliasTagsPass();
6364
std::unique_ptr<mlir::Pass>
6465
createAddDebugInfoPass(fir::AddDebugInfoOptions options = {});
65-
std::unique_ptr<mlir::Pass> createLoopVersioningPass();
6666

6767
std::unique_ptr<mlir::Pass>
6868
createMemoryAllocationPass(bool dynOnHeap, std::size_t maxStackSize);

flang/include/flang/Optimizer/Transforms/Passes.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ def LoopVersioning : Pass<"loop-versioning", "mlir::func::FuncOp"> {
321321
an array has element sized stride. The element sizes stride allows some
322322
loops to be vectorized as well as other loop optimizations.
323323
}];
324-
let constructor = "::fir::createLoopVersioningPass()";
325324
let dependentDialects = [ "fir::FIROpsDialect" ];
326325
}
327326

flang/include/flang/Tools/CLOptions.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ inline void createDefaultFIROptimizerPassPipeline(
253253
}
254254

255255
if (pc.LoopVersioning)
256-
pm.addPass(fir::createLoopVersioningPass());
256+
pm.addPass(fir::createLoopVersioning());
257257

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

flang/lib/Optimizer/Transforms/LoopVersioning.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,3 @@ void LoopVersioningPass::runOnOperation() {
556556

557557
LLVM_DEBUG(llvm::dbgs() << "=== End " DEBUG_TYPE " ===\n");
558558
}
559-
560-
std::unique_ptr<mlir::Pass> fir::createLoopVersioningPass() {
561-
return std::make_unique<LoopVersioningPass>();
562-
}

0 commit comments

Comments
 (0)