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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
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).