[PATCH] D133318: [Assignment Tracking][21/*] Account for assignment tracking in inliner

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 5 08:48:52 PDT 2022


Orlando created this revision.
Orlando added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The inliner requires two additions:

`fixupAssignments` -  Update inlined instructions' DIAssignID metadata so that inlined `DIAssignID` attachments are unique to the inlined instance.

`trackInlinedStores` - Treat inlined stores to caller-local variables (i.e. callee stores to argument pointers that point to the caller's allocas) as assignments. Track them using `trackAssignments`, which is the same method as is used by the `AssignmentTrackingPass`. This means that we're able to detect stale memory locations due to DSE after inlining. Because the stores are only tracked _after_ inlining, any DSE or movement of stores _before_ inlining will not be accounted for. This is an accepted limitation mentioned in the RFC <https://discourse.llvm.org/t/rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir/62367>.

One change is also required:

Update `CloneBlock` to preserve debug use-before-defs. Otherwise the assignments will be dropped due to having the intrinsic operands replaced with empty metadata (see use-before-def.ll in this patch and this related discourse post <https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value/65019>.


https://reviews.llvm.org/D133318

Files:
  llvm/lib/Transforms/Utils/CloneFunction.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/DebugInfo/Generic/assignment-tracking/inline/id.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/inline/inline-stores.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/inline/use-before-def.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133318.457982.patch
Type: text/x-patch
Size: 34108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220905/328eb866/attachment.bin>


More information about the llvm-commits mailing list