From 84fb481bf51ed69e5cf0780319ba72ead5420732 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Sun, 10 Apr 2022 15:30:35 -0400 Subject: [PATCH] Respect -Z verify-llvm-ir and other flags that add extra passes when combined with -C no-prepopulate-passes in the new LLVM Pass Manager. --- compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 7030fd53704..71f21dc6666 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -995,6 +995,13 @@ LLVMRustOptimizeWithNewPassManager( break; } } + } else { + // We're not building any of the default pipelines but we still want to + // add the verifier, instrumentation, etc passes if they were requested + for (const auto &C : PipelineStartEPCallbacks) + C(MPM, OptLevel); + for (const auto &C : OptimizerLastEPCallbacks) + C(MPM, OptLevel); } if (ExtraPassesLen) {