Skip to content

Commit 839b91c

Browse files
authored
[clang] Move -fprofile-instrument-use-path= check to driver (#159667)
The frontend currently opens the path provided via `-fprofile-instrument-use-path=` to learn the kind of the instrumentation data and set the `CodeGenOptions::ProfileUse` value. This happens during command-line parsing, where we don't have a correctly configured VFS yet, so the behavior is quite different from all other frontend inputs. We need to move this logic out of the frontend command line parsing logic somewhere where we do have the configured VFS. The complication is that the `ProfileUse` flag is being used to set preprocessor macros, and there isn't a great place between command line parsing and preprocessor initialization to perform this logic. This PR solves the issue by deducing the kind of instrumentation data right in the driver and then passing it via a new flag to the frontend. This shouldn't change observable behavior of Clang on the driver level, and only affects the frontend command line interface, which is an implementation detail anyway.
1 parent d3d7c3c commit 839b91c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+167
-129
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,9 @@ def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
683683
"option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored">,
684684
InGroup<OptionIgnored>;
685685

686+
def err_drv_profile_instrument_use_path_with_no_kind : Error<
687+
"option '-fprofile-instrument-use-path=' requires -fprofile-instrument-use=<kind>">;
688+
686689
def note_drv_verify_prefix_spelling : Note<
687690
"-verify prefixes must start with a letter and contain only alphanumeric"
688691
" characters, hyphens, and underscores">;

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7957,6 +7957,11 @@ def fprofile_instrument_path_EQ : Joined<["-"], "fprofile-instrument-path=">,
79577957
HelpText<"Generate instrumented code to collect execution counts into "
79587958
"<file> (overridden by LLVM_PROFILE_FILE env var)">,
79597959
MarshallingInfoString<CodeGenOpts<"InstrProfileOutput">>;
7960+
def fprofile_instrument_use_EQ : Joined<["-"], "fprofile-instrument-use=">,
7961+
HelpText<"Enable PGO use instrumentation">, Values<"none,clang,llvm,csllvm,sample-coldcov">,
7962+
NormalizedValuesScope<"llvm::driver::ProfileInstrKind">,
7963+
NormalizedValues<["ProfileNone", "ProfileClangInstr", "ProfileIRInstr", "ProfileCSIRInstr", "ProfileIRSampleColdCov"]>,
7964+
MarshallingInfoEnum<CodeGenOpts<"ProfileUse">, "ProfileNone">;
79607965
def fprofile_instrument_use_path_EQ :
79617966
Joined<["-"], "fprofile-instrument-use-path=">,
79627967
HelpText<"Specify the profile path in PGO use compilation">,

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,15 @@ CodeGenModule::CodeGenModule(ASTContext &C,
493493
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
494494
CodeGenOpts.ProfileInstrumentUsePath, *FS,
495495
CodeGenOpts.ProfileRemappingFile);
496-
// We're checking for profile read errors in CompilerInvocation, so if
497-
// there was an error it should've already been caught. If it hasn't been
498-
// somehow, trip an assertion.
499-
assert(ReaderOrErr);
496+
if (auto E = ReaderOrErr.takeError()) {
497+
unsigned DiagID = Diags.getCustomDiagID(
498+
DiagnosticsEngine::Error, "Error in reading profile %0: %1");
499+
llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
500+
Diags.Report(DiagID)
501+
<< CodeGenOpts.ProfileInstrumentUsePath << EI.message();
502+
});
503+
return;
504+
}
500505
PGOReader = std::move(ReaderOrErr.get());
501506
}
502507

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "llvm/Frontend/Debug/Options.h"
4242
#include "llvm/Object/ObjectFile.h"
4343
#include "llvm/Option/ArgList.h"
44+
#include "llvm/ProfileData/InstrProfReader.h"
4445
#include "llvm/Support/CodeGen.h"
4546
#include "llvm/Support/Compiler.h"
4647
#include "llvm/Support/Compression.h"
@@ -485,19 +486,47 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
485486
}
486487

487488
if (ProfileUseArg) {
489+
SmallString<128> UsePathBuf;
490+
StringRef UsePath;
488491
if (ProfileUseArg->getOption().matches(options::OPT_fprofile_instr_use_EQ))
489-
CmdArgs.push_back(Args.MakeArgString(
490-
Twine("-fprofile-instrument-use-path=") + ProfileUseArg->getValue()));
492+
UsePath = ProfileUseArg->getValue();
491493
else if ((ProfileUseArg->getOption().matches(
492494
options::OPT_fprofile_use_EQ) ||
493495
ProfileUseArg->getOption().matches(
494496
options::OPT_fprofile_instr_use))) {
495-
SmallString<128> Path(
496-
ProfileUseArg->getNumValues() == 0 ? "" : ProfileUseArg->getValue());
497-
if (Path.empty() || llvm::sys::fs::is_directory(Path))
498-
llvm::sys::path::append(Path, "default.profdata");
497+
UsePathBuf =
498+
ProfileUseArg->getNumValues() == 0 ? "" : ProfileUseArg->getValue();
499+
if (UsePathBuf.empty() || llvm::sys::fs::is_directory(UsePathBuf))
500+
llvm::sys::path::append(UsePathBuf, "default.profdata");
501+
UsePath = UsePathBuf;
502+
}
503+
auto ReaderOrErr =
504+
llvm::IndexedInstrProfReader::create(UsePath, D.getVFS());
505+
if (auto E = ReaderOrErr.takeError()) {
506+
auto DiagID = D.getDiags().getCustomDiagID(
507+
DiagnosticsEngine::Error, "Error in reading profile %0: %1");
508+
llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
509+
D.Diag(DiagID) << UsePath.str() << EI.message();
510+
});
511+
} else {
512+
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader =
513+
std::move(ReaderOrErr.get());
514+
StringRef UseKind;
515+
// Currently memprof profiles are only added at the IR level. Mark the
516+
// profile type as IR in that case as well and the subsequent matching
517+
// needs to detect which is available (might be one or both).
518+
if (PGOReader->isIRLevelProfile() || PGOReader->hasMemoryProfile()) {
519+
if (PGOReader->hasCSIRLevelProfile())
520+
UseKind = "csllvm";
521+
else
522+
UseKind = "llvm";
523+
} else
524+
UseKind = "clang";
525+
526+
CmdArgs.push_back(
527+
Args.MakeArgString("-fprofile-instrument-use=" + UseKind));
499528
CmdArgs.push_back(
500-
Args.MakeArgString(Twine("-fprofile-instrument-use-path=") + Path));
529+
Args.MakeArgString("-fprofile-instrument-use-path=" + UsePath));
501530
}
502531
}
503532

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,34 +1473,6 @@ static std::string serializeXRayInstrumentationBundle(const XRayInstrSet &S) {
14731473
return Buffer;
14741474
}
14751475

1476-
// Set the profile kind using fprofile-instrument-use-path.
1477-
static void setPGOUseInstrumentor(CodeGenOptions &Opts,
1478-
const Twine &ProfileName,
1479-
llvm::vfs::FileSystem &FS,
1480-
DiagnosticsEngine &Diags) {
1481-
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName, FS);
1482-
if (auto E = ReaderOrErr.takeError()) {
1483-
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
1484-
"Error in reading profile %0: %1");
1485-
llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
1486-
Diags.Report(DiagID) << ProfileName.str() << EI.message();
1487-
});
1488-
return;
1489-
}
1490-
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader =
1491-
std::move(ReaderOrErr.get());
1492-
// Currently memprof profiles are only added at the IR level. Mark the profile
1493-
// type as IR in that case as well and the subsequent matching needs to detect
1494-
// which is available (might be one or both).
1495-
if (PGOReader->isIRLevelProfile() || PGOReader->hasMemoryProfile()) {
1496-
if (PGOReader->hasCSIRLevelProfile())
1497-
Opts.setProfileUse(llvm::driver::ProfileInstrKind::ProfileCSIRInstr);
1498-
else
1499-
Opts.setProfileUse(llvm::driver::ProfileInstrKind::ProfileIRInstr);
1500-
} else
1501-
Opts.setProfileUse(llvm::driver::ProfileInstrKind::ProfileClangInstr);
1502-
}
1503-
15041476
void CompilerInvocation::setDefaultPointerAuthOptions(
15051477
PointerAuthOptions &Opts, const LangOptions &LangOpts,
15061478
const llvm::Triple &Triple) {
@@ -5090,16 +5062,10 @@ bool CompilerInvocation::CreateFromArgsImpl(
50905062
append_range(Res.getCodeGenOpts().CommandLineArgs, CommandLineArgs);
50915063
}
50925064

5093-
// Set PGOOptions. Need to create a temporary VFS to read the profile
5094-
// to determine the PGO type.
5095-
if (!Res.getCodeGenOpts().ProfileInstrumentUsePath.empty()) {
5096-
auto FS =
5097-
createVFSFromOverlayFiles(Res.getHeaderSearchOpts().VFSOverlayFiles,
5098-
Diags, llvm::vfs::getRealFileSystem());
5099-
setPGOUseInstrumentor(Res.getCodeGenOpts(),
5100-
Res.getCodeGenOpts().ProfileInstrumentUsePath, *FS,
5101-
Diags);
5102-
}
5065+
if (!Res.getCodeGenOpts().ProfileInstrumentUsePath.empty() &&
5066+
Res.getCodeGenOpts().getProfileUse() ==
5067+
llvm::driver::ProfileInstrKind::ProfileNone)
5068+
Diags.Report(diag::err_drv_profile_instrument_use_path_with_no_kind);
51035069

51045070
FixupInvocation(Res, Diags, Args, DashX);
51055071

clang/test/CodeGen/cspgo-instrumentation.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
// RUN: llvm-profdata merge -o %t/noncs.profdata %S/Inputs/pgotestir.proftext
1010
//
1111
// Ensure Pass PGOInstrumentationUsePass and PGOInstrumentationGenPass are invoked.
12-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/noncs.profdata -fprofile-instrument=csllvm -fprofile-instrument-path=default.profraw %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2
12+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t/noncs.profdata -fprofile-instrument=csllvm -fprofile-instrument-path=default.profraw %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2
1313
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2: Running pass: PGOInstrumentationUse
1414
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2: Running pass: PGOInstrumentationGenCreateVar on
1515
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2: Running pass: PGOInstrumentationGen on
1616

1717
// Ensure Pass PGOInstrumentationUsePass is invoked only once.
18-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/noncs.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE
18+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t/noncs.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE
1919
// CHECK-PGOUSEPASS-INVOKED-USE: Running pass: PGOInstrumentationUse
2020
// CHECK-PGOUSEPASS-INVOKED-USE-NOT: Running pass: PGOInstrumentationGenCreateVar
2121
// CHECK-PGOUSEPASS-INVOKED-USE-NOT: Running pass: PGOInstrumentationUse
2222
//
2323
// Ensure Pass PGOInstrumentationUsePass is invoked twice.
2424
// RUN: llvm-profdata merge -o %t/cs.profdata %S/Inputs/pgotestir_cs.proftext
25-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/cs.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE2
25+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=csllvm -fprofile-instrument-use-path=%t/cs.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE2
2626
// CHECK-PGOUSEPASS-INVOKED-USE2: Running pass: PGOInstrumentationUse
2727
// CHECK-PGOUSEPASS-INVOKED-USE2: Running pass: PGOInstrumentationUse

clang/test/CodeGen/cspgo-instrumentation_lto.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// RUN: llvm-profdata merge -o %t/noncs.profdata %S/Inputs/pgotestir.proftext
55
//
66
// Ensure Pass PGOInstrumentationGenPass is not invoked in PreLink.
7-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/noncs.profdata -fprofile-instrument=csllvm %s -flto -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE
7+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t/noncs.profdata -fprofile-instrument=csllvm %s -flto -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE
88
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE: Running pass: PGOInstrumentationUse
99
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE: Running pass: PGOInstrumentationGenCreateVar
1010
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE-NOT: Running pass: PGOInstrumentationGen on
@@ -18,12 +18,12 @@
1818
// RUN: llvm-profdata merge -o %t/cs.profdata %S/Inputs/pgotestir_cs.proftext
1919
//
2020
// Ensure Pass PGOInstrumentationUsePass is invoked Once in PreLink.
21-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/cs.profdata %s -flto -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE
21+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=csllvm -fprofile-instrument-use-path=%t/cs.profdata %s -flto -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE
2222
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE: Running pass: PGOInstrumentationUse
2323
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE-NOT: Running pass: PGOInstrumentationGenCreateVar
2424
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE-NOT: Running pass: PGOInstrumentationUse
2525
//
2626
// Ensure Pass PGOInstrumentationUSEPass is invoked in PostLink.
27-
// RUN: %clang_cc1 -O2 -x ir %t/foo_fe_pm.bc -fdebug-pass-manager -fprofile-instrument-use-path=%t/cs.profdata -flto -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST
27+
// RUN: %clang_cc1 -O2 -x ir %t/foo_fe_pm.bc -fdebug-pass-manager -fprofile-instrument-use=csllvm -fprofile-instrument-use-path=%t/cs.profdata -flto -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST
2828
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST: Running pass: PGOInstrumentationUse
2929
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST-NOT: Running pass: PGOInstrumentationUse

clang/test/CodeGen/cspgo-instrumentation_thinlto.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// RUN: llvm-profdata merge -o %t/noncs.profdata %S/Inputs/pgotestir.proftext
55
//
66
// Ensure Pass PGOInstrumentationGenPass is not invoked in PreLink.
7-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/noncs.profdata -fprofile-instrument=csllvm %s -fprofile-instrument-path=default.profraw -flto=thin -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE
7+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t/noncs.profdata -fprofile-instrument=csllvm %s -fprofile-instrument-path=default.profraw -flto=thin -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE
88
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE: Running pass: PGOInstrumentationUse
99
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE: Running pass: PGOInstrumentationGenCreateVar
1010
// CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN-PRE-NOT: Running pass: PGOInstrumentationGen on
@@ -19,16 +19,16 @@
1919
// RUN: llvm-profdata merge -o %t/cs.profdata %S/Inputs/pgotestir_cs.proftext
2020
//
2121
// Ensure Pass PGOInstrumentationUsePass is invoked Once in PreLink.
22-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/cs.profdata %s -flto=thin -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE
22+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=csllvm -fprofile-instrument-use-path=%t/cs.profdata %s -flto=thin -fdebug-pass-manager -emit-llvm-bc -o %t/foo_fe_pm.bc 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE
2323
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE: Running pass: PGOInstrumentationUse
2424
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-PRE-NOT: Running pass: PGOInstrumentationUse
2525
//
2626
// RUN: llvm-lto -thinlto -o %t/foo_pm %t/foo_fe_pm.bc
2727
// Ensure Pass PGOInstrumentationUSEPass is invoked in PostLink.
28-
// RUN: %clang_cc1 -O2 -x ir %t/foo_fe_pm.bc -fthinlto-index=%t/foo_pm.thinlto.bc -fdebug-pass-manager -fprofile-instrument-use-path=%t/cs.profdata -flto=thin -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST
28+
// RUN: %clang_cc1 -O2 -x ir %t/foo_fe_pm.bc -fthinlto-index=%t/foo_pm.thinlto.bc -fdebug-pass-manager -fprofile-instrument-use=csllvm -fprofile-instrument-use-path=%t/cs.profdata -flto=thin -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST
2929
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST: Running pass: PGOInstrumentationUse
3030
// CHECK-CSPGOUSEPASS-INVOKED-INSTR-USE-POST-NOT: Running pass: PGOInstrumentationUse
3131
//
3232
// Finally, test if a non-cs profile is passed to PostLink passes, PGO UsePass is not invoked.
33-
// RUN: %clang_cc1 -O2 -x ir %t/foo_fe_pm.bc -fthinlto-index=%t/foo_pm.thinlto.bc -fdebug-pass-manager -fprofile-instrument-use-path=%t/noncs.profdata -flto=thin -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-INSTR-USE-POST
33+
// RUN: %clang_cc1 -O2 -x ir %t/foo_fe_pm.bc -fthinlto-index=%t/foo_pm.thinlto.bc -fdebug-pass-manager -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t/noncs.profdata -flto=thin -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-INSTR-USE-POST
3434
// CHECK-PGOUSEPASS-INVOKED-INSTR-USE-POST-NOT: Running pass: PGOInstrumentationUse

clang/test/CodeGen/opt-record.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -opt-record-file %t.yaml -emit-obj
22
// RUN: cat %t.yaml | FileCheck %s
33
// RUN: llvm-profdata merge %S/Inputs/opt-record.proftext -o %t.profdata
4-
// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -fprofile-instrument-use-path=%t.profdata %s -o %t -opt-record-file %t.yaml -emit-obj
4+
// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata %s -o %t -opt-record-file %t.yaml -emit-obj
55
// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK -check-prefix=CHECK-PGO %s
66
// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -opt-record-file %t.yaml -opt-record-passes inline -emit-obj
77
// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK-PASSES %s

clang/test/CodeGen/pgo-instrumentation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
// Ensure Pass PGOInstrumentationUsePass is invoked.
1717
// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgotestir.profraw
18-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-INSTR-USE
18+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-INSTR-USE
1919
// CHECK-PGOUSEPASS-INVOKED-INSTR-USE: Running pass: PGOInstrumentationUse on
2020
//
2121
// Ensure Pass PGOInstrumentationUsePass is not invoked.
2222
// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgotestclang.profraw
23-
// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE-CLANG
23+
// RUN: %clang_cc1 -O2 -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE-CLANG
2424
// CHECK-PGOUSEPASS-INVOKED-USE-CLANG-NOT: Running pass: PGOInstrumentationUse on

0 commit comments

Comments
 (0)