[flang-commits] [flang] 46b66df - [flang][NFC] use tablegen to create StackArrays constructor (#90038)
via flang-commits
flang-commits at lists.llvm.org
Fri Apr 26 02:55:59 PDT 2024
Author: Tom Eccles
Date: 2024-04-26T10:55:56+01:00
New Revision: 46b66dfd31ed0206b4444b77612df42193fe5b42
URL: https://github.com/llvm/llvm-project/commit/46b66dfd31ed0206b4444b77612df42193fe5b42
DIFF: https://github.com/llvm/llvm-project/commit/46b66dfd31ed0206b4444b77612df42193fe5b42.diff
LOG: [flang][NFC] use tablegen to create StackArrays constructor (#90038)
Stack arrays needs to stay running only on func.func because it needs to
know which block terminators can end the function (rather than just
branch between unstructured control flow). A similar concept does not
exist at the more abstract level of "any top level mlir operation".
For example, it currently looks for func::ReturnOp and
fir::UnreachableOp as points when execution can end. If this were to be
run on omp.declare_reduction, it would also need to understand
omp.YieldOp (perhaps only when omp.declare_reduction is the parent).
There isn't a generic concept in MLIR for this.
Added:
Modified:
flang/include/flang/Optimizer/Transforms/Passes.h
flang/include/flang/Optimizer/Transforms/Passes.td
flang/include/flang/Tools/CLOptions.inc
flang/lib/Optimizer/Transforms/StackArrays.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h
index 613e606954652a..5532271bad705f 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.h
+++ b/flang/include/flang/Optimizer/Transforms/Passes.h
@@ -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_STACKARRAYS
#define GEN_PASS_DECL_LOOPVERSIONING
#include "flang/Optimizer/Transforms/Passes.h.inc"
@@ -59,7 +60,6 @@ createExternalNameConversionPass(bool appendUnderscore);
std::unique_ptr<mlir::Pass> createMemDataFlowOptPass();
std::unique_ptr<mlir::Pass> createPromoteToAffinePass();
std::unique_ptr<mlir::Pass> createMemoryAllocationPass();
-std::unique_ptr<mlir::Pass> createStackArraysPass();
std::unique_ptr<mlir::Pass> createAliasTagsPass();
std::unique_ptr<mlir::Pass>
createAddDebugInfoPass(fir::AddDebugInfoOptions options = {});
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index 383b1628b7153c..6b490569e01de6 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -257,7 +257,6 @@ def StackArrays : Pass<"stack-arrays", "mlir::ModuleOp"> {
allocations.
}];
let dependentDialects = [ "fir::FIROpsDialect" ];
- let constructor = "::fir::createStackArraysPass()";
}
def AddAliasTags : Pass<"fir-add-alias-tags", "mlir::ModuleOp"> {
diff --git a/flang/include/flang/Tools/CLOptions.inc b/flang/include/flang/Tools/CLOptions.inc
index 0b031abe0e6026..4fab9ef423bc33 100644
--- a/flang/include/flang/Tools/CLOptions.inc
+++ b/flang/include/flang/Tools/CLOptions.inc
@@ -258,7 +258,7 @@ inline void createDefaultFIROptimizerPassPipeline(
pm.addPass(mlir::createCSEPass());
if (pc.StackArrays)
- pm.addPass(fir::createStackArraysPass());
+ pm.addPass(fir::createStackArrays());
else
fir::addMemoryAllocationOpt(pm);
diff --git a/flang/lib/Optimizer/Transforms/StackArrays.cpp b/flang/lib/Optimizer/Transforms/StackArrays.cpp
index 1c213abefe6f5f..c81524dd16a77e 100644
--- a/flang/lib/Optimizer/Transforms/StackArrays.cpp
+++ b/flang/lib/Optimizer/Transforms/StackArrays.cpp
@@ -776,7 +776,3 @@ void StackArraysPass::runOnFunc(mlir::Operation *func) {
signalPassFailure();
}
}
-
-std::unique_ptr<mlir::Pass> fir::createStackArraysPass() {
- return std::make_unique<StackArraysPass>();
-}
More information about the flang-commits
mailing list