Skip to content

Commit 5cfe5b3

Browse files
Rollup merge of #155656 - durin42:llvm-23-back-in-kansas, r=nikic
rustc_llvm: update opt-level handling for LLVM 23 LLVM 23 removed Os and Oz optimization pipelines and the PR says to use O2 with optsize or minsize instead as appropriate. See llvm/llvm-project#191363 for more details.
2 parents e33cc78 + f6b8f0b commit 5cfe5b3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,17 @@ static OptimizationLevel fromRust(LLVMRustPassBuilderOptLevel Level) {
165165
return OptimizationLevel::O2;
166166
case LLVMRustPassBuilderOptLevel::O3:
167167
return OptimizationLevel::O3;
168+
#if LLVM_VERSION_GE(23, 0)
169+
case LLVMRustPassBuilderOptLevel::Os:
170+
return OptimizationLevel::O2;
171+
case LLVMRustPassBuilderOptLevel::Oz:
172+
return OptimizationLevel::O2;
173+
#else
168174
case LLVMRustPassBuilderOptLevel::Os:
169175
return OptimizationLevel::Os;
170176
case LLVMRustPassBuilderOptLevel::Oz:
171177
return OptimizationLevel::Oz;
178+
#endif
172179
default:
173180
report_fatal_error("Bad PassBuilderOptLevel.");
174181
}

0 commit comments

Comments
 (0)