Skip to content

Commit 09a93b4

Browse files
committed
[clang] Move -fprofile-instrument-use-path= check to driver (llvm#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 1bafc75 commit 09a93b4

Some content is hidden

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

48 files changed

+179
-136
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
@@ -8098,6 +8098,11 @@ def fprofile_instrument_path_EQ : Joined<["-"], "fprofile-instrument-path=">,
80988098
HelpText<"Generate instrumented code to collect execution counts into "
80998099
"<file> (overridden by LLVM_PROFILE_FILE env var)">,
81008100
MarshallingInfoString<CodeGenOpts<"InstrProfileOutput">>;
8101+
def fprofile_instrument_use_EQ : Joined<["-"], "fprofile-instrument-use=">,
8102+
HelpText<"Enable PGO use instrumentation">, Values<"none,clang,llvm,csllvm,sample-coldcov">,
8103+
NormalizedValuesScope<"llvm::driver::ProfileInstrKind">,
8104+
NormalizedValues<["ProfileNone", "ProfileClangInstr", "ProfileIRInstr", "ProfileCSIRInstr", "ProfileIRSampleColdCov"]>,
8105+
MarshallingInfoEnum<CodeGenOpts<"ProfileUse">, "ProfileNone">;
81018106
def fprofile_instrument_use_path_EQ :
81028107
Joined<["-"], "fprofile-instrument-use-path=">,
81038108
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
@@ -496,10 +496,15 @@ CodeGenModule::CodeGenModule(ASTContext &C,
496496
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
497497
CodeGenOpts.ProfileInstrumentUsePath, *FS,
498498
CodeGenOpts.ProfileRemappingFile);
499-
// We're checking for profile read errors in CompilerInvocation, so if
500-
// there was an error it should've already been caught. If it hasn't been
501-
// somehow, trip an assertion.
502-
assert(ReaderOrErr);
499+
if (auto E = ReaderOrErr.takeError()) {
500+
unsigned DiagID = Diags.getCustomDiagID(
501+
DiagnosticsEngine::Error, "Error in reading profile %0: %1");
502+
llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
503+
Diags.Report(DiagID)
504+
<< CodeGenOpts.ProfileInstrumentUsePath << EI.message();
505+
});
506+
return;
507+
}
503508
PGOReader = std::move(ReaderOrErr.get());
504509
}
505510

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"
@@ -502,19 +503,47 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
502503
}
503504

504505
if (ProfileUseArg) {
506+
SmallString<128> UsePathBuf;
507+
StringRef UsePath;
505508
if (ProfileUseArg->getOption().matches(options::OPT_fprofile_instr_use_EQ))
506-
CmdArgs.push_back(Args.MakeArgString(
507-
Twine("-fprofile-instrument-use-path=") + ProfileUseArg->getValue()));
509+
UsePath = ProfileUseArg->getValue();
508510
else if ((ProfileUseArg->getOption().matches(
509511
options::OPT_fprofile_use_EQ) ||
510512
ProfileUseArg->getOption().matches(
511513
options::OPT_fprofile_instr_use))) {
512-
SmallString<128> Path(
513-
ProfileUseArg->getNumValues() == 0 ? "" : ProfileUseArg->getValue());
514-
if (Path.empty() || llvm::sys::fs::is_directory(Path))
515-
llvm::sys::path::append(Path, "default.profdata");
514+
UsePathBuf =
515+
ProfileUseArg->getNumValues() == 0 ? "" : ProfileUseArg->getValue();
516+
if (UsePathBuf.empty() || llvm::sys::fs::is_directory(UsePathBuf))
517+
llvm::sys::path::append(UsePathBuf, "default.profdata");
518+
UsePath = UsePathBuf;
519+
}
520+
auto ReaderOrErr =
521+
llvm::IndexedInstrProfReader::create(UsePath, D.getVFS());
522+
if (auto E = ReaderOrErr.takeError()) {
523+
auto DiagID = D.getDiags().getCustomDiagID(
524+
DiagnosticsEngine::Error, "Error in reading profile %0: %1");
525+
llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
526+
D.Diag(DiagID) << UsePath.str() << EI.message();
527+
});
528+
} else {
529+
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader =
530+
std::move(ReaderOrErr.get());
531+
StringRef UseKind;
532+
// Currently memprof profiles are only added at the IR level. Mark the
533+
// profile type as IR in that case as well and the subsequent matching
534+
// needs to detect which is available (might be one or both).
535+
if (PGOReader->isIRLevelProfile() || PGOReader->hasMemoryProfile()) {
536+
if (PGOReader->hasCSIRLevelProfile())
537+
UseKind = "csllvm";
538+
else
539+
UseKind = "llvm";
540+
} else
541+
UseKind = "clang";
542+
543+
CmdArgs.push_back(
544+
Args.MakeArgString("-fprofile-instrument-use=" + UseKind));
516545
CmdArgs.push_back(
517-
Args.MakeArgString(Twine("-fprofile-instrument-use-path=") + Path));
546+
Args.MakeArgString("-fprofile-instrument-use-path=" + UsePath));
518547
}
519548
}
520549

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,34 +1621,6 @@ createBaseFS(const FileSystemOptions &FSOpts, const FrontendOptions &FEOpts,
16211621
return FS;
16221622
}
16231623

1624-
// Set the profile kind using fprofile-instrument-use-path.
1625-
static void setPGOUseInstrumentor(CodeGenOptions &Opts,
1626-
const Twine &ProfileName,
1627-
llvm::vfs::FileSystem &FS,
1628-
DiagnosticsEngine &Diags) {
1629-
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName, FS);
1630-
if (auto E = ReaderOrErr.takeError()) {
1631-
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
1632-
"Error in reading profile %0: %1");
1633-
llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
1634-
Diags.Report(DiagID) << ProfileName.str() << EI.message();
1635-
});
1636-
return;
1637-
}
1638-
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader =
1639-
std::move(ReaderOrErr.get());
1640-
// Currently memprof profiles are only added at the IR level. Mark the profile
1641-
// type as IR in that case as well and the subsequent matching needs to detect
1642-
// which is available (might be one or both).
1643-
if (PGOReader->isIRLevelProfile() || PGOReader->hasMemoryProfile()) {
1644-
if (PGOReader->hasCSIRLevelProfile())
1645-
Opts.setProfileUse(llvm::driver::ProfileInstrKind::ProfileCSIRInstr);
1646-
else
1647-
Opts.setProfileUse(llvm::driver::ProfileInstrKind::ProfileIRInstr);
1648-
} else
1649-
Opts.setProfileUse(llvm::driver::ProfileInstrKind::ProfileClangInstr);
1650-
}
1651-
16521624
void CompilerInvocation::setDefaultPointerAuthOptions(
16531625
PointerAuthOptions &Opts, const LangOptions &LangOpts,
16541626
const llvm::Triple &Triple) {
@@ -2214,12 +2186,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
22142186
: llvm::codegenoptions::DebugTemplateNamesKind::Mangled);
22152187
}
22162188

2217-
if (!Opts.ProfileInstrumentUsePath.empty()) {
2218-
auto FS = createBaseFS(FSOpts, FEOpts, CASOpts, Diags,
2219-
llvm::vfs::getRealFileSystem(), nullptr);
2220-
setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath, *FS, Diags);
2221-
}
2222-
22232189
if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ,
22242190
OPT_ftime_report_json)) {
22252191
Opts.TimePasses = true;
@@ -5644,6 +5610,11 @@ bool CompilerInvocation::CreateFromArgsImpl(
56445610
append_range(Res.getCodeGenOpts().CommandLineArgs, CommandLineArgs);
56455611
}
56465612

5613+
if (!Res.getCodeGenOpts().ProfileInstrumentUsePath.empty() &&
5614+
Res.getCodeGenOpts().getProfileUse() ==
5615+
llvm::driver::ProfileInstrKind::ProfileNone)
5616+
Diags.Report(diag::err_drv_profile_instrument_use_path_with_no_kind);
5617+
56475618
FixupInvocation(Res, Diags, Args, DashX);
56485619

56495620
return Diags.getNumErrors() == NumErrorsBefore;

clang/test/CAS/pgo-profile-with-pch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgo.profraw
66
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t-pch.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-pch -O3 -Rcompile-job-cache \
7-
// RUN: -x c-header %s -o %t.h.pch -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.profdata
7+
// RUN: -x c-header %s -o %t.h.pch -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata
88
// RUN: %clang @%t-pch.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-MISS
99
// RUN: FileCheck %s -check-prefix=PCHPROF -input-file %t-pch.rsp
1010
// PCHPROF-NOT: -fprofile-instrument-use-path
@@ -14,14 +14,14 @@
1414

1515
// Use the modified profdata file for the main file along with the PCH.
1616
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache \
17-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.profdata -include-pch %t.h.pch
17+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata -include-pch %t.h.pch
1818
// RUN: %clang @%t.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-MISS
1919
// RUN: FileCheck %s -check-prefix=TUPROF -input-file %t.rsp
2020
// TUPROF: -fprofile-instrument-use-path
2121

2222
// Check that the modified profdata is ignored when re-scanning for the PCH.
2323
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t-pch2.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-pch -O3 -Rcompile-job-cache \
24-
// RUN: -x c-header %s -o %t.h.pch -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.profdata
24+
// RUN: -x c-header %s -o %t.h.pch -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata
2525
// RUN: diff -u %t-pch.rsp %t-pch2.rsp
2626

2727
// CACHE-MISS: remark: compile job cache miss

clang/test/CAS/pgo-profile.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// Check use pgo profile.
44
// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgo.profraw
55
// RUN: %clang -cc1depscan -fdepscan=inline -o %t.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache \
6-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.profdata
6+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata
77

88
/// Remove profile data to make sure the cc1 command is not reading from file system.
99
// RUN: rm %t.profdata
@@ -13,20 +13,20 @@
1313
/// Check include tree.
1414
// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgo.profraw
1515
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t1.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache \
16-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.profdata
16+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata
1717
// RUN: rm %t.profdata
1818
// RUN: %clang @%t1.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-MISS
1919
// RUN: %clang @%t1.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-HIT
2020

2121
/// Check change profile data will cause cache miss.
2222
// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgo2.profraw
2323
// RUN: %clang -cc1depscan -fdepscan=inline -o %t2.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache \
24-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.profdata
24+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata
2525
// RUN: not diff %t.rsp %t2.rsp
2626
// RUN: %clang @%t2.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-MISS
2727

2828
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t3.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache \
29-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.profdata
29+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata
3030
// RUN: not diff %t1.rsp %t3.rsp
3131
// RUN: %clang @%t3.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-MISS
3232

@@ -38,9 +38,9 @@
3838
// RUN: cp %t.profdata %t.dir/a/a.profdata
3939
// RUN: cp %t.profdata %t.dir/b/a.profdata
4040
// RUN: %clang -cc1depscan -fdepscan=inline -o %t4.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache -fdepscan-prefix-map %t.dir/a /^testdir \
41-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.dir/a/a.profdata
41+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.dir/a/a.profdata
4242
// RUN: %clang -cc1depscan -fdepscan=inline -o %t5.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache -fdepscan-prefix-map %t.dir/b /^testdir \
43-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.dir/b/a.profdata
43+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.dir/b/a.profdata
4444
// RUN: cat %t4.rsp | FileCheck %s --check-prefix=REMAP
4545
// RUN: %clang @%t4.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-MISS
4646
// RUN: %clang @%t5.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-HIT
@@ -55,9 +55,9 @@
5555
// RUN: diff -u %t.dir/cache-key1 %t.dir/cache-key2
5656

5757
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t4.inc.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache -fdepscan-prefix-map %t.dir/a /^testdir \
58-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.dir/a/a.profdata
58+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.dir/a/a.profdata
5959
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t5.inc.rsp -cc1-args -cc1 -triple x86_64-apple-macosx12.0.0 -emit-obj -O3 -Rcompile-job-cache -fdepscan-prefix-map %t.dir/b /^testdir \
60-
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use-path=%t.dir/b/a.profdata
60+
// RUN: -x c %s -o %t.o -fcas-path %t.dir/cas -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.dir/b/a.profdata
6161
// RUN: cat %t4.inc.rsp | FileCheck %s --check-prefix=REMAP
6262
// RUN: %clang @%t4.inc.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-MISS
6363
// RUN: %clang @%t5.inc.rsp 2>&1 | FileCheck %s --check-prefix=CACHE-HIT

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

0 commit comments

Comments
 (0)