Skip to content

Commit 71d9759

Browse files
Second update for review comments
1 parent c97dbb1 commit 71d9759

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

flang/include/flang/Tools/CrossToolHelpers.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef FORTRAN_TOOLS_CROSS_TOOL_HELPERS_H
1414
#define FORTRAN_TOOLS_CROSS_TOOL_HELPERS_H
1515

16+
#include "flang/Frontend/CodeGenOptions.h"
1617
#include "flang/Frontend/LangOptions.h"
1718
#include <cstdint>
1819

@@ -26,6 +27,15 @@ struct MLIRToLLVMPassPipelineConfig {
2627
explicit MLIRToLLVMPassPipelineConfig(llvm::OptimizationLevel level) {
2728
OptLevel = level;
2829
}
30+
explicit MLIRToLLVMPassPipelineConfig(llvm::OptimizationLevel level,
31+
const Fortran::frontend::CodeGenOptions &opts) {
32+
OptLevel = level;
33+
StackArrays = opts.StackArrays;
34+
Underscoring = opts.Underscoring;
35+
LoopVersioning = opts.LoopVersioning;
36+
DebugInfo = opts.getDebugInfo();
37+
}
38+
2939
llvm::OptimizationLevel OptLevel; ///< optimisation level
3040
bool StackArrays = false; ///< convert memory allocations to alloca.
3141
bool Underscoring = true; ///< add underscores to function names.

flang/lib/Frontend/FrontendActions.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -713,15 +713,7 @@ void CodeGenAction::generateLLVMIR() {
713713
pm.addPass(std::make_unique<Fortran::lower::VerifierPass>());
714714
pm.enableVerifier(/*verifyPasses=*/true);
715715

716-
const auto targetOpts = ci.getInvocation().getTargetOpts();
717-
const llvm::Triple triple(targetOpts.triple);
718-
719-
MLIRToLLVMPassPipelineConfig config(level);
720-
721-
config.StackArrays = opts.StackArrays;
722-
config.Underscoring = opts.Underscoring;
723-
config.LoopVersioning = opts.LoopVersioning;
724-
config.DebugInfo = opts.getDebugInfo();
716+
MLIRToLLVMPassPipelineConfig config(level, opts);
725717

726718
// Create the pass pipeline
727719
fir::createMLIRToLLVMPassPipeline(pm, config);

0 commit comments

Comments
 (0)