Skip to content

Commit 242defe

Browse files
author
Nuri Amari
committed
Provide default --cs-profile-path= for distributed thin-lto builds
When -fcs-profile-generate is used with a distributed compile without specifying a profile output path somehow, we fail the following assertion: https://github.com/llvm/llvm-project/blob/6041c745f32e8fd60ed24e29e7d919d8d1c87ca6/llvm/lib/Support/PGOOptions.cpp#L36 Avoid the assertion by choosing a default output path as other LTO mechanisms (ie. local thin-lto) do.
1 parent fc06ad4 commit 242defe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ runThinLTOBackend(CompilerInstance &CI, ModuleSummaryIndex *CombinedIndex,
13341334
// Context sensitive profile.
13351335
if (CGOpts.hasProfileCSIRInstr()) {
13361336
Conf.RunCSIRInstr = true;
1337-
Conf.CSIRProfile = std::move(CGOpts.InstrProfileOutput);
1337+
Conf.CSIRProfile = getProfileGenName(CGOpts);
13381338
} else if (CGOpts.hasProfileCSIRUse()) {
13391339
Conf.RunCSIRInstr = false;
13401340
Conf.CSIRProfile = std::move(CGOpts.ProfileInstrumentUsePath);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: mkdir -p %t
2+
// RUN: %clang -target x86_64-apple-darwin -fcs-profile-generate -flto=thin -c -o %t/main.bc %s
3+
// RUN: llvm-lto2 run --thinlto-distributed-indexes %t/main.bc -o %t/index -r=%t/main.bc,_main,px
4+
// RUN: %clang -target x86_64-apple-darwin -fcs-profile-generate -c %t/main.o -fthinlto-index=%t/main.bc.thinlto.bc %t/main.bc
5+
6+
int main() {
7+
return 0;
8+
}

0 commit comments

Comments
 (0)