diff --git a/src/codegen.cpp b/src/codegen.cpp index fa6e0904c45c4..879092d49d6e1 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5809,7 +5809,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)