[flang-commits] [flang] [flang][NFCI]Use config structure for MLIR to LLVM pass creation (PR #67792)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Fri Sep 29 05:03:23 PDT 2023


================
@@ -18,6 +18,24 @@
 
 #include "mlir/Dialect/OpenMP/OpenMPDialect.h"
 #include "mlir/IR/BuiltinOps.h"
+#include "llvm/Frontend/Debug/Options.h"
+#include "llvm/Passes/OptimizationLevel.h"
+
+/// Configuriation for the MLIR to LLVM pass pipeline.
+struct MLIRToLLVMPassPipelineConfig {
+  MLIRToLLVMPassPipelineConfig(llvm::OptimizationLevel level) {
+    OptLevel = level;
+    StackArrays = false;
----------------
tblah wrote:

nit: This could be written more concisely

```c++
struct MLIRToLLVMPassPipelineConfig {
  MLIRToLLVMPassPipelineConfig(llvm::OptimizationLevel level): OptLevel{level} {}
  llvm::OptimizationLevel OptLevel;
  bool StackArrays = false;
  bool Underscoring = true;
  bool LoopVersioning = false;
  llvm::codegenoptions::DebugInfoKind DebugInfo = llvm::codegenoptions::NoDebugInfo;
};
```

https://github.com/llvm/llvm-project/pull/67792


More information about the flang-commits mailing list