Since r268966 the modern Verifier pass defaults to stripping invalid debug info in nonasserts builds. This patch ports this behavior back to the legacy Verifier pass as well. The primary motivation is that the clang frontend accepts bitcode files as input but is still using the legacy pass pipeline. Background: The problem I'm trying to solve with this sequence of patches is that historically we've done a really bad job at verifying debug info. We want to be able to make the verifier stricter without having to worry about breaking bitcode compatibility with existing producers. For example, we don't necessarily want IR produced by an older version of clang to be rejected by an LTO link just because of malformed debug info, and rather provide an option to strip it. Note that merely outdated (but well-formed) debug info would continue to be auto-upgraded in this scenario. <rdar://problem/26448800>
Details
- Reviewers
mehdi_amini
Diff Detail
Event Timeline
I didn't know there was a modern and a "legacy" one. Is it suppose to go away? Could we just nuke it and move clang to the new one?
Since r268966 the modern Verifier pass defaults to stripping invalid debug info in nonasserts builds. This patch ports this behavior back to the legacy Verifier pass as well.
This sentence makes me expect a difference between release and assert builds, and I don't spot it in this patch.
lib/IR/Verifier.cpp | ||
---|---|---|
4475 | It is not clear to me why new VerifierLegacyPass() has a different behavior with respect to debug info compared to new VerifierLegacyPass(true) or new VerifierLegacyPass(false) (these last two will have the same behavior in face of debug info. |
This is certainly the intended long-term prospect, but that would mean rewriting the majority of clang's BackendUtil, which I don't feel qualified for at the moment. It may not even be possible because not all passes have been ported to the new pass manager.
The difference is this assert:
assert(!V.hasBrokenDebugInfo() && "Module contains invalid debug info");
lib/IR/Verifier.cpp | ||
---|---|---|
4475 | Good catch, they probably shouldn't. |
It is not clear to me why new VerifierLegacyPass() has a different behavior with respect to debug info compared to new VerifierLegacyPass(true) or new VerifierLegacyPass(false) (these last two will have the same behavior in face of debug info.