From 9d1bd2e067a82d6a2552b3705bbe6f256e9bde0c Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Mon, 12 Feb 2024 19:13:09 -0500 Subject: [PATCH] PassWrapper: adapt for llvm/llvm-project@93cdd1b5cfa3735c599949b77e24dbfbe570441a Should be no functional change. @rustbot label: +llvm-main --- compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 3b6bf03686b0d..a358a40f92bd0 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -43,6 +43,9 @@ #include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation/AddressSanitizer.h" #include "llvm/Support/TimeProfiler.h" +#if LLVM_VERSION_GE(19, 0) +#include "llvm/Support/PGOOptions.h" +#endif #include "llvm/Transforms/Instrumentation/GCOVProfiler.h" #include "llvm/Transforms/Instrumentation/InstrProfiling.h" #include "llvm/Transforms/Instrumentation/ThreadSanitizer.h" @@ -749,6 +752,9 @@ LLVMRustOptimize( FS, #endif PGOOptions::IRInstr, PGOOptions::NoCSAction, +#if LLVM_VERSION_GE(19, 0) + PGOOptions::ColdFuncOpt::Default, +#endif DebugInfoForProfiling); } else if (PGOUsePath) { assert(!PGOSampleUsePath); @@ -758,6 +764,9 @@ LLVMRustOptimize( FS, #endif PGOOptions::IRUse, PGOOptions::NoCSAction, +#if LLVM_VERSION_GE(19, 0) + PGOOptions::ColdFuncOpt::Default, +#endif DebugInfoForProfiling); } else if (PGOSampleUsePath) { PGOOpt = PGOOptions(PGOSampleUsePath, "", "", @@ -766,6 +775,9 @@ LLVMRustOptimize( FS, #endif PGOOptions::SampleUse, PGOOptions::NoCSAction, +#if LLVM_VERSION_GE(19, 0) + PGOOptions::ColdFuncOpt::Default, +#endif DebugInfoForProfiling); } else if (DebugInfoForProfiling) { PGOOpt = PGOOptions("", "", "", @@ -774,6 +786,9 @@ LLVMRustOptimize( FS, #endif PGOOptions::NoAction, PGOOptions::NoCSAction, +#if LLVM_VERSION_GE(19, 0) + PGOOptions::ColdFuncOpt::Default, +#endif DebugInfoForProfiling); }