[flang-commits] [flang] eeb9fcd - [flang][HLFIR][NFC] Use tablegen to reduce assignment pass boilerplate (#93030)
via flang-commits
flang-commits at lists.llvm.org
Wed May 22 08:48:54 PDT 2024
Author: Tom Eccles
Date: 2024-05-22T16:48:50+01:00
New Revision: eeb9fcddf5f29ce967442437f15dea174bb04345
URL: https://github.com/llvm/llvm-project/commit/eeb9fcddf5f29ce967442437f15dea174bb04345
DIFF: https://github.com/llvm/llvm-project/commit/eeb9fcddf5f29ce967442437f15dea174bb04345.diff
LOG: [flang][HLFIR][NFC] Use tablegen to reduce assignment pass boilerplate (#93030)
This pass is module-level and then runs on all operations implementing
the ordered assignment interface. It should not matter which top-level
operation the assignment is inside of.
This commit removes some unnecessary boilerplate that we can generate
automatically with tablegen.
Added:
Modified:
flang/include/flang/Optimizer/HLFIR/Passes.h
flang/include/flang/Optimizer/HLFIR/Passes.td
flang/include/flang/Tools/CLOptions.inc
flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/HLFIR/Passes.h b/flang/include/flang/Optimizer/HLFIR/Passes.h
index 5035415ede2d9..e0b4111eed6bf 100644
--- a/flang/include/flang/Optimizer/HLFIR/Passes.h
+++ b/flang/include/flang/Optimizer/HLFIR/Passes.h
@@ -25,7 +25,6 @@ namespace hlfir {
std::unique_ptr<mlir::Pass> createConvertHLFIRtoFIRPass();
std::unique_ptr<mlir::Pass> createBufferizeHLFIRPass();
std::unique_ptr<mlir::Pass> createLowerHLFIRIntrinsicsPass();
-std::unique_ptr<mlir::Pass> createLowerHLFIROrderedAssignmentsPass();
#define GEN_PASS_REGISTRATION
#include "flang/Optimizer/HLFIR/Passes.h.inc"
diff --git a/flang/include/flang/Optimizer/HLFIR/Passes.td b/flang/include/flang/Optimizer/HLFIR/Passes.td
index 0fe2d9c0a632d..9555467a57adc 100644
--- a/flang/include/flang/Optimizer/HLFIR/Passes.td
+++ b/flang/include/flang/Optimizer/HLFIR/Passes.td
@@ -34,7 +34,6 @@ def LowerHLFIRIntrinsics : Pass<"lower-hlfir-intrinsics", "::mlir::ModuleOp"> {
def LowerHLFIROrderedAssignments : Pass<"lower-hlfir-ordered-assignments", "::mlir::ModuleOp"> {
let summary = "Lower HLFIR ordered assignments like forall and where operations";
- let constructor = "hlfir::createLowerHLFIROrderedAssignmentsPass()";
let options = [
Option<"tryFusingAssignments", "fuse-assignments",
"bool", /*default=*/"false",
diff --git a/flang/include/flang/Tools/CLOptions.inc b/flang/include/flang/Tools/CLOptions.inc
index 82a8aece82756..69934281fa992 100644
--- a/flang/include/flang/Tools/CLOptions.inc
+++ b/flang/include/flang/Tools/CLOptions.inc
@@ -327,7 +327,7 @@ inline void createHLFIRToFIRPassPipeline(
addNestedPassToAllTopLevelOperations(
pm, hlfir::createOptimizedBufferization);
}
- pm.addPass(hlfir::createLowerHLFIROrderedAssignmentsPass());
+ pm.addPass(hlfir::createLowerHLFIROrderedAssignments());
pm.addPass(hlfir::createLowerHLFIRIntrinsicsPass());
pm.addPass(hlfir::createBufferizeHLFIRPass());
pm.addPass(hlfir::createConvertHLFIRtoFIRPass());
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
index c9ff4b1c33741..a1a89bb5154fb 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
@@ -1383,6 +1383,9 @@ class LowerHLFIROrderedAssignments
: public hlfir::impl::LowerHLFIROrderedAssignmentsBase<
LowerHLFIROrderedAssignments> {
public:
+ using LowerHLFIROrderedAssignmentsBase<
+ LowerHLFIROrderedAssignments>::LowerHLFIROrderedAssignmentsBase;
+
void runOnOperation() override {
// Running on a ModuleOp because this pass may generate FuncOp declaration
// for runtime calls. This could be a FuncOp pass otherwise.
@@ -1409,7 +1412,3 @@ class LowerHLFIROrderedAssignments
}
};
} // namespace
-
-std::unique_ptr<mlir::Pass> hlfir::createLowerHLFIROrderedAssignmentsPass() {
- return std::make_unique<LowerHLFIROrderedAssignments>();
-}
More information about the flang-commits
mailing list