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

Mats Petersson via flang-commits flang-commits at lists.llvm.org
Fri Sep 29 05:47:42 PDT 2023


================
@@ -713,10 +713,18 @@ void CodeGenAction::generateLLVMIR() {
   pm.addPass(std::make_unique<Fortran::lower::VerifierPass>());
   pm.enableVerifier(/*verifyPasses=*/true);
 
+  const auto targetOpts = ci.getInvocation().getTargetOpts();
+  const llvm::Triple triple(targetOpts.triple);
+
+  MLIRToLLVMPassPipelineConfig config(level);
+
+  config.StackArrays = opts.StackArrays;
+  config.Underscoring = opts.Underscoring;
+  config.LoopVersioning = opts.LoopVersioning;
+  config.DebugInfo = opts.getDebugInfo();
+
----------------
Leporacanthicus wrote:

I don't think that helps readability. I'd rather make a constructor that takes the opts, but I also [when this is in, and I'm doing the next step of adding another couple of fields] sometimes need to set some variables from language options, which complicates things. This is the only place where we're setting all of the options. 

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


More information about the flang-commits mailing list