This is an archive of the discontinued LLVM Phabricator instance.

RFC: More principled implementation of DISubprogram::describes()
ClosedPublic

Authored by aprantl on Feb 26 2020, 2:32 PM.

Details

Summary
commit 3c2d70434bd750683baa94432bfe9fd1f639f968
Author: Duncan P. N. Exon Smith <dexonsmith@apple.com>
Date:   Mon Apr 13 19:07:27 2015 +0000

    DebugInfo: Migrate DISubprogram::describes() to new hierarchy, NFC
    
    I don't really like this function at all -- I think it should be as
    simple as `return getFunction() == F` -- but for now this seems like the
    best we can do.
    
    llvm-svn: 234778

I'm not sure if we still need the name check. Perhaps there are some LTO cases where this is necessary but it's not clear to me what they are.

Diff Detail

Event Timeline

aprantl created this revision.Feb 26 2020, 2:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2020, 2:32 PM
Herald added a subscriber: hiraditya. · View Herald Transcript

If you're worried about LTO, I suggest trying a clang bootstrap with each of -flto=full and -flto=thin. I was using the former as a testcase when I was doing this work, so I think we'd get good signal from that.

llvm/lib/IR/DebugInfoMetadata.cpp
663

Nitpick, I think we usually leave the redundant parens off for return statements.

ThinLTO and FullLTO stage builds of all dependencies of check-clang succeeded with this change.

I'm inclined to try to commit this and see if we get any "describes" assertion reports.

I'm inclined to try to commit this and see if we get any "describes" assertion reports.

SGTM.

llvm/lib/IR/Verifier.cpp
2397

Should this FIXME be updated?

2401

It's not obvious to me why this call is no longer necessary.

aprantl marked an inline comment as done.Feb 28 2020, 11:28 AM
aprantl added inline comments.
llvm/lib/IR/Verifier.cpp
2401

because the SP->describes(&F) call on line 2398 will either

  • fail, in which case we found an error and can stop
  • succeed, in which case we must have visited the subprogram already when we entered the function
dexonsmith accepted this revision.Feb 28 2020, 11:51 AM

Okay, LGTM then, as long as...

ThinLTO and FullLTO stage builds of all dependencies of check-clang succeeded with this change.

Did you confirm that none of the debug info was stripped? IIRC, if debug info doesn't verify during LTO it gets stripped rather than causing a failure.

This revision is now accepted and ready to land.Feb 28 2020, 11:51 AM

Okay, LGTM then, as long as...

ThinLTO and FullLTO stage builds of all dependencies of check-clang succeeded with this change.

Did you confirm that none of the debug info was stripped? IIRC, if debug info doesn't verify during LTO it gets stripped rather than causing a failure.

Good point! I should have seen that as a warning in the linker output if it happened.

This revision was automatically updated to reflect the committed changes.