This is an archive of the discontinued LLVM Phabricator instance.

[DebugMetadata] Simplify handling subprogram's retainedNodes field. NFCI (1/7)
ClosedPublic

Authored by dzhidzhoev on Feb 14 2023, 12:24 AM.

Details

Summary

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Currently, retainedNodes tracks function-local variables and labels.
To support function-local import, types and static variables (which are globals
in LLVM IR), subsequent patches use the same field. So this patch makes
preliminary refactoring of the code tracking local entities to apply future
functional changes lucidly and cleanly.

No functional changes intended.

Diff Detail

Event Timeline

krisb created this revision.Feb 14 2023, 12:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 12:24 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
krisb published this revision for review.Feb 17 2023, 6:24 AM
krisb edited the summary of this revision. (Show Details)
krisb added reviewers: dblaikie, jmmartinez.
krisb added projects: Restricted Project, debug-info.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2023, 6:24 AM
jmmartinez added inline comments.Feb 20 2023, 1:14 AM
llvm/lib/IR/DIBuilder.cpp
789

I'll be tempted to move the call to getSubprogramNodesTrackingVector(Scope) into createLocalVariable. It seems that every time createLocalVariable is called, getSubprogramNodesTrackingVector(Scope) is passed as value for PreservedNodes.

(I've just started reviewing so I may be missing some other modifications)

@jmmartinez thank you for looking at this!

llvm/lib/IR/DIBuilder.cpp
789

That's right, but the problem is in the fact that createLocalVariable() is static while getSubprogramNodesTrackingVector() is a DIBuilder's member. To move the call inside createLocalVariable() we need either to make it a member of DIBuilder or to pass DIBuilder object to it. None of these options looks much better to me, honestly.

jmmartinez added inline comments.Feb 23 2023, 4:36 AM
llvm/lib/IR/DIBuilder.cpp
789

You're right. I didn't realize createLocalVariable was not a member of DIBuilder.

Ok for me to keep it as it .

krisb added a comment.Mar 2 2023, 7:54 AM

Friendly ping.

ykhatav added a subscriber: ykhatav.Mar 3 2023, 8:55 AM
aprantl added inline comments.Mar 6 2023, 5:36 PM
llvm/include/llvm/IR/DIBuilder.h
76–79

Do you need a writeable copy, or could you get by with returning an ArrayRef<TrackingMDNodeRef>?

krisb marked an inline comment as done.Mar 7 2023, 1:57 AM
krisb added inline comments.
llvm/include/llvm/IR/DIBuilder.h
76–79

It should return smth suitable to emplace new elements, so, right, we need a writable reference here.

Sorry for the delay, I was out-of-office. Patches 1 to 4 look good to me. If nobody raises concerns this week I'll mark them as accepted.

I'm currently reviewing patch 5.

jmmartinez accepted this revision.Mar 10 2023, 6:09 AM
This revision is now accepted and ready to land.Mar 10 2023, 6:09 AM
dblaikie accepted this revision.Mar 10 2023, 10:47 AM
krisb updated this revision to Diff 504602.Mar 13 2023, 5:27 AM

Rebase.

dzhidzhoev commandeered this revision.May 15 2023, 4:59 AM
dzhidzhoev added a reviewer: krisb.
dzhidzhoev added a subscriber: dzhidzhoev.

@krisb is out of office for some time, so she asked to retake and wrap up this patchset.

Looks like this series got approved - is it waiting on any particular feedback, or do you need someone to commit it for you?

Looks like this series got approved - is it waiting on any particular feedback, or do you need someone to commit it for you?

I had been waiting for approval for the change of https://reviews.llvm.org/D144008. How would you suggest landing these commits - individually or all at once?

Looks like this series got approved - is it waiting on any particular feedback, or do you need someone to commit it for you?

I had been waiting for approval for the change of https://reviews.llvm.org/D144008. How would you suggest landing these commits - individually or all at once?

Ah, fair enough.

It's a tough balance - committing them all at once can make it difficult to see which specific change is the cause of a regression/buildbot failure/etc. But committing them too far apart can cause large chunks of breakage/harder to revert, etc. So... probably close-ish together, let the bots give you some results before pushing the next patch, maybe?

Looks like this series got approved - is it waiting on any particular feedback, or do you need someone to commit it for you?

I had been waiting for approval for the change of https://reviews.llvm.org/D144008. How would you suggest landing these commits - individually or all at once?

Ah, fair enough.

It's a tough balance - committing them all at once can make it difficult to see which specific change is the cause of a regression/buildbot failure/etc. But committing them too far apart can cause large chunks of breakage/harder to revert, etc. So... probably close-ish together, let the bots give you some results before pushing the next patch, maybe?

Agreed.

This revision was landed with ongoing or failed builds.Jun 7 2023, 7:43 AM
This revision was automatically updated to reflect the committed changes.

I think this patch broke two build bots, and now the CI is red.
https://lab.llvm.org/buildbot/#/builders/16/builds/49282
https://lab.llvm.org/buildbot/#/builders/109/builds/65904

Could you please have a look?

I think this patch broke two build bots, and now the CI is red.
https://lab.llvm.org/buildbot/#/builders/16/builds/49282
https://lab.llvm.org/buildbot/#/builders/109/builds/65904

Could you please have a look?

Thank you! Reverted.
Does anyone know if there is a possibility to subscribe to buildbot emails related to a specific commit if you're not the author of the commit?

I think this patch broke two build bots, and now the CI is red.
https://lab.llvm.org/buildbot/#/builders/16/builds/49282
https://lab.llvm.org/buildbot/#/builders/109/builds/65904

Could you please have a look?

Thank you! Reverted.
Does anyone know if there is a possibility to subscribe to buildbot emails related to a specific commit if you're not the author of the commit?

To me, it would make sense if its a shared responsibility, or at least the person pushing the commit to see if it needs to be reverted. IDK of any guidelines though.

When we migrated to github we gained higher fidelity for attributing authors (we can now commit on someone's behalf but have the commit author properly recorded as the real author - we couldn't do that back on Subversion) - but I think it's meant that fail-mail from bots goes to that author, and not to the committer. Ideally it'd go to both - so, as it stands now, being a commiter-but-not-author is tricky, because you don't get the feedback on the commit you made. You might watch buildbots manually, or at least bhe responsive to other people complaining on the reviews like this.

Updated DebugInfo test of OCaml binding.

When we migrated to github we gained higher fidelity for attributing authors (we can now commit on someone's behalf but have the commit author properly recorded as the real author - we couldn't do that back on Subversion) - but I think it's meant that fail-mail from bots goes to that author, and not to the committer. Ideally it'd go to both - so, as it stands now, being a commiter-but-not-author is tricky, because you don't get the feedback on the commit you made. You might watch buildbots manually, or at least bhe responsive to other people complaining on the reviews like this.

Thanks! We agreed to use Authored-by attribute.