This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by zero9178 on Mar 27 2021, 10:05 AM.

Details

Summary

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.

Diff Detail

Event Timeline

zero9178 requested review of this revision.Mar 27 2021, 10:05 AM
zero9178 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2021, 10:05 AM
vsk added a comment.Mar 29 2021, 9:31 AM

Please add a test. I think I've reproduced the bug with this:

~/src/gh-llvm-project-main/llvm/test/tools/llvm-profdata (0) % cat merge-incompatible.test 
RUN: not llvm-profdata merge %p/Inputs/fe-basic.proftext %p/Inputs/ir-basic.proftext -o /dev/null

~/src/gh-llvm-project-main/llvm/test/tools/llvm-profdata (0) % cat Inputs/{fe,ir}-basic.proftext
:fe
foo
29667547796
2
100
90

:ir
foo2
29667547796
2
100
90
zero9178 updated this revision to Diff 333928.Mar 29 2021, 10:50 AM

Thanks a lot for the help.
I have now added tests that reproduce the issue and also ensure the error is emitted.

vsk accepted this revision.Mar 29 2021, 4:09 PM

Thanks, lgtm!

This revision is now accepted and ready to land.Mar 29 2021, 4:09 PM