1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[llvm-profdata] Make sure to consume Error on the error path of setIsIRLevelProfile

Encountered a crash while running a debug build, where this code path would be taken due to a mismatch in profile coverage data versions. Without consuming the error, an assert would be triggered inside the destructor of Error.

Differential Revision: https://reviews.llvm.org/D99457
This commit is contained in:
Markus Böck 2021-03-30 08:52:28 +02:00
parent 6c2532788a
commit c3d482652f
4 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,6 @@
:fe
foo
29667547796
2
100
90

View File

@ -0,0 +1,6 @@
:ir
foo2
29667547796
2
100
90

View File

@ -0,0 +1,2 @@
RUN: not llvm-profdata merge %p/Inputs/fe-basic.proftext %p/Inputs/ir-basic.proftext -o /dev/null 2>&1 | FileCheck %s
CHECK: ir-basic.proftext: Merge IR generated profile with Clang generated profile.

View File

@ -251,7 +251,8 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper,
auto Reader = std::move(ReaderOrErr.get());
bool IsIRProfile = Reader->isIRLevelProfile();
bool HasCSIRProfile = Reader->hasCSIRLevelProfile();
if (WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) {
if (Error E = WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) {
consumeError(std::move(E));
WC->Errors.emplace_back(
make_error<StringError>(
"Merge IR generated profile with Clang generated profile.",