This is an archive of the discontinued LLVM Phabricator instance.

[Assignment Tracking][SROA] Delete dbg.assigns linked to rewritten stores
ClosedPublic

Authored by Orlando on Jan 30 2023, 3:15 AM.

Details

Summary

AggLoadStoreRewriter splits aggregate loads and stores into scalars (before the alloca is split up). The new stores and debug intrinsics are already wired up correctly - we just need to also delete the dbg.assign that is linked to the split to-be-deleted store too.

Diff Detail

Event Timeline

Orlando created this revision.Jan 30 2023, 3:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2023, 3:15 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Orlando requested review of this revision.Jan 30 2023, 3:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2023, 3:15 AM
jmorse accepted this revision.Jan 31 2023, 3:50 AM

LGTM -- and for my understanding, this is because the assignments have been replaced, leaving the dbg.assign hanging around in the case of DSE would be the correct behaviour, yes?

I suppose if that's the case, then there's no scope for automating/refactoring this kind of instrumentation, because replacing/removing have to be separate stages.

This revision is now accepted and ready to land.Jan 31 2023, 3:50 AM
Orlando added a comment.EditedJan 31 2023, 5:45 AM

LGTM -- and for my understanding, this is because the assignments have been replaced, leaving the dbg.assign hanging around in the case of DSE would be the correct behaviour, yes?

I suppose if that's the case, then there's no scope for automating/refactoring this kind of instrumentation, because replacing/removing have to be separate stages.

Thanks. Yeah - when the store is split the dbg.assigns are cloned and updated (to reflect the split offset/size) - that's done along a code path started by the emitSplitOps call just above the added code.

then there's no scope for automating/refactoring this kind of instrumentation, because replacing/removing have to be separate stages.

It's probably possible - we'd essentially have to keep a mapping of {pre-split allocas/stores: split instructions} and do the debug-fragment splitting at the end - though we'd end up having to change a few things such as not-deleting instructions during the pass (e.g. the code path shown in this diff). Updating as we go along seems to be the path of least resistance (though this implementation isn't perfect -- I have another patching coming soon that fixes some problems with the fragment calculations).

This revision was landed with ongoing or failed builds.Feb 10 2023, 1:57 AM
This revision was automatically updated to reflect the committed changes.