This is an archive of the discontinued LLVM Phabricator instance.

[opt] Strip coverage if debug info is not present
ClosedPublic

Authored by davide on Oct 17 2016, 12:03 PM.

Details

Summary

This is reduced from: https://llvm.org/bugs/show_bug.cgi?id=30702
If -coverage is passed, but -g is not, clang populates the PassManager pipeline with StripSymbols(debugOnly = true).
The stripSymbol pass therefore scans the list of named metadata, drops !llvm.dbg.cu, but leaves !llvm.gcov and !0 (the compileUnit MD) around. The verifier runs, and finds out that there's a CU not listed in !llvm.dbg.cu (as it was previously dropped) -> assertion.
When we strip debug info, so, check if there's coverage data around, and strip it as well, in order to avoid pending metadata left around.

Diff Detail

Repository
rL LLVM

Event Timeline

davide updated this revision to Diff 74879.Oct 17 2016, 12:03 PM
davide retitled this revision from to [opt] Strip coverage if debug info is not present.
davide updated this object.
davide added reviewers: aprantl, vsk.
davide added a subscriber: llvm-commits.

Once this lands I'll submit a clang patch to warn if -coverage is passed but -g is not in the clang Driver (as discussed with Justin/Adrian)

aprantl accepted this revision.Oct 17 2016, 1:08 PM
aprantl edited edge metadata.

Thanks!

This revision is now accepted and ready to land.Oct 17 2016, 1:08 PM
This revision was automatically updated to reflect the committed changes.