diff --git a/src/codegen.cpp b/src/codegen.cpp index 90153be89fe5e..6e931439ac3b7 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5951,7 +5951,7 @@ extern "C" void jl_init_codegen(void) #ifdef DISABLE_OPT .setOptLevel(CodeGenOpt::None) #else - .setOptLevel(CodeGenOpt::Aggressive) + .setOptLevel(jl_options.opt_level == 0 ? CodeGenOpt::None : CodeGenOpt::Aggressive) #endif #if defined(USE_MCJIT) && !defined(LLVM36) .setUseMCJIT(true)