if (CodeGenOpts.hasProfileIRUse())
PGOOpt.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath;
+ if (!CodeGenOpts.SampleProfileFile.empty())
+ PGOOpt.SampleProfileFile = CodeGenOpts.SampleProfileFile;
+
// Only pass a PGO options struct if -fprofile-generate or
// -fprofile-use were passed on the cmdline.
PassBuilder PB(TM.get(),
(PGOOpt.RunProfileGen ||
- !PGOOpt.ProfileUseFile.empty()) ?
+ !PGOOpt.ProfileUseFile.empty() ||
+ !PGOOpt.SampleProfileFile.empty()) ?
Optional<PGOOptions>(PGOOpt) : None);
LoopAnalysisManager LAM;
// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// FIXME: Run the following command once LTOPreLinkDefaultPipeline is
+// customized.
+// %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
// Checks if hot call is inlined by normal compile, but not inlined by
// thinlto compile.
// SAMPLEPGO-LABEL: define void @icp
// THINLTO-LABEL: define void @icp
// SAMPLEPGO: if.true.direct_targ
-// ThinLTO-NOT: if.true.direct_targ
+// FIXME: the following condition needs to be reversed once
+// LTOPreLinkDefaultPipeline is customized.
+// THINLTO-NOT: if.true.direct_targ
void icp(void (*p)()) {
p();
}