[flang-commits] [flang] [flang][HLFIR][NFC] Use tablegen to reduce assignment pass boilerplate (PR #93030)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed May 22 06:27:05 PDT 2024
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/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.
>From b00d1943d9331849fe013bb23ad5cf2d5c7ba0f1 Mon Sep 17 00:00:00 2001
From: Tom Eccles <tom.eccles at arm.com>
Date: Fri, 17 May 2024 15:26:21 +0000
Subject: [PATCH] [flang][HLFIR][NFC] Use tablegen to reduce assignment pass
boilerplate
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.
---
flang/include/flang/Optimizer/HLFIR/Passes.h | 1 -
flang/include/flang/Optimizer/HLFIR/Passes.td | 1 -
flang/include/flang/Tools/CLOptions.inc | 2 +-
.../HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp | 7 +++----
4 files changed, 4 insertions(+), 7 deletions(-)
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