This is an archive of the discontinued LLVM Phabricator instance.

[Verifier] Check that all subprogram definitions are reachable from dbg.cu
Needs ReviewPublic

Authored by loladiro on Jan 15 2016, 8:51 AM.

Details

Summary

The backend requires that any subprogram definition belongs to some compile unit that is declared in the llvm.dbg.cu named metadata node. Check this, by going through all of them at the very beginning of module Verification, and adding them to the MDNodes set. After this initial pass, getting to any subprogram definition again is an error, because it means that such a subprogram was not referenced from llvm.dbg.cu.

Diff Detail

Event Timeline

loladiro updated this revision to Diff 44997.Jan 15 2016, 8:51 AM
loladiro retitled this revision from to [Verifier] Check that all subprogram definitions are reachable from dbg.cu.
loladiro updated this object.
loladiro added reviewers: dexonsmith, dblaikie.
loladiro set the repository for this revision to rL LLVM.
loladiro added a subscriber: llvm-commits.
dblaikie edited edge metadata.Jan 15 2016, 9:33 AM
dblaikie added a subscriber: dblaikie.

Diego: I /think/ this isn't true when we're attaching debug info just for
backend diagnostic purposes, right? Do we have some test cases covering
that?

loladiro updated this revision to Diff 45010.Jan 15 2016, 10:22 AM
loladiro edited edge metadata.

Some extra test cases need chainging for the case when the llvm.dbg.cu metadata node does not exist.

loladiro updated this revision to Diff 45042.Jan 15 2016, 3:23 PM

Found a case where my new verfier check wasn't working + Whole load of new test case fixes.

The only cases I've found in the test cases that intentionally omit compile units from the .cu node are the AddDiscriminator tests. Are those the ones you are thinking about. For now, I made them all isDefinition: false. However, if this is something we want to support (creating debug info, but not codegening it), how about we just create a different global named metadata llvm.dbg.cu.noemit (bad name, please suggest something better), into which we pull all compile units we don't want to emit, but the Verifier could still look at it.

dexonsmith resigned from this revision.Oct 6 2020, 3:47 PM