about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-03-13 09:44:45 +0900
committerGitHub <noreply@github.com>2021-03-13 09:44:45 +0900
commitfafbc91e0e533ff9293afba5094558629a1a41e3 (patch)
tree66fd7483f3c4589243e2a0343818878a36f0d0f0 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent04e24ae67e48025469601a32c3adf8c7c93ee742 (diff)
parent65ed23c2827a5771718fe72762bca345dde6ec79 (diff)
downloadrust-fafbc91e0e533ff9293afba5094558629a1a41e3.tar.gz
rust-fafbc91e0e533ff9293afba5094558629a1a41e3.zip
Rollup merge of #83037 - kubo39:merge-functions-in-llvm-new-pass-manager, r=nikic
Support merge_functions option in NewPM since LLVM >= 12

now we can pass this flag since https://reviews.llvm.org/D93002 has been merged.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index 2f28162f908..e7c210b6c7a 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -772,14 +772,18 @@ LLVMRustOptimizeWithNewPassManager(
   TargetMachine *TM = unwrap(TMRef);
   PassBuilder::OptimizationLevel OptLevel = fromRust(OptLevelRust);
 
-  // FIXME: MergeFunctions is not supported by NewPM yet.
-  (void) MergeFunctions;
 
   PipelineTuningOptions PTO;
   PTO.LoopUnrolling = UnrollLoops;
   PTO.LoopInterleaving = UnrollLoops;
   PTO.LoopVectorization = LoopVectorize;
   PTO.SLPVectorization = SLPVectorize;
+#if LLVM_VERSION_GE(12, 0)
+  PTO.MergeFunctions = MergeFunctions;
+#else
+  // MergeFunctions is not supported by NewPM in older LLVM versions.
+  (void) MergeFunctions;
+#endif
 
   // FIXME: We may want to expose this as an option.
   bool DebugPassManager = false;