[flang-commits] [flang] [flang] Remove hardcoded bits from AddDebugInfo. (PR #89231)

via flang-commits flang-commits at lists.llvm.org
Fri Apr 19 01:48:23 PDT 2024


================
@@ -283,34 +301,35 @@ inline void createOpenMPFIRPassPipeline(
 }
 
 #if !defined(FLANG_EXCLUDE_CODEGEN)
-inline void createDebugPasses(
-    mlir::PassManager &pm, llvm::codegenoptions::DebugInfoKind debugLevel) {
+inline void createDebugPasses(mlir::PassManager &pm,
+    llvm::codegenoptions::DebugInfoKind debugLevel,
+    llvm::OptimizationLevel OptLevel, llvm::StringRef inputFilename) {
   // Currently only -g1, -g, -gline-tables-only supported
   switch (debugLevel) {
   case llvm::codegenoptions::DebugLineTablesOnly:
-    addDebugInfoPass(pm);
+    addDebugInfoPass(pm, debugLevel, OptLevel, inputFilename);
     return;
   case llvm::codegenoptions::NoDebugInfo:
     return;
   default:
     // TODO: Add cases and passes for other debug options.
     // All other debug options not implemented yet, currently emits warning
     // and generates as much debug information as possible.
-    addDebugInfoPass(pm);
+    addDebugInfoPass(pm, debugLevel, OptLevel, inputFilename);
     return;
----------------
jeanPerier wrote:

Given you are forwarding the debug level to the pass now, it seems like you can transform the switch into:
```
if (debugLevel != llvm::codegenoptions::NoDebugInfo)
  addDebugInfoPass(pm, debugLevel, OptLevel, inputFilename);
```


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


More information about the flang-commits mailing list