[PATCH] D146980: [Assignment Tracking] Coalesce dbg loc definitions with contiguous fragments

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 09:11:35 PDT 2023


Orlando created this revision.
Orlando added reviewers: jmorse, StephenTozer, scott.linder.
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.

`MemLocFragmentFill` uses an `IntervalMap` to track which bits of each variable are stack-homed. Intervals with the same value (same stack location base address) are automatically coalesced by the map. This patch changes the analysis to take advantage of that and insert a new dbg loc after each def if any coalescing took place. This results in some additional redundant defs (we insert a def, then another that by definition shadows the previous one if any coalescing took place) but they're all cleaned up thanks to the previous patch in this stack.

This reduces the total number of fragments created by AssignmentTrackingAnalysis which reduces compile time because LiveDebugValues computes SSA for every fragment it encounters. There's a geomean reduction in instructions retired in a CTMark LTO-O3-g build of 0.3% with these two patches.

One small caveat is that this technique can produce partially overlapping fragments (e.g. slice [0, 32) and slice [16, 64)), which we know LiveDebugVariables doesn't really handle correctly. Used in combination with instruction-referencing this isn't a problem, since LiveDebugVariables is effectively side-stepped in instruction-referencing mode.


https://reviews.llvm.org/D146980

Files:
  llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
  llvm/test/DebugInfo/assignment-tracking/X86/coalesce-cfg.ll
  llvm/test/DebugInfo/assignment-tracking/X86/coalesce-simple.ll
  llvm/test/DebugInfo/assignment-tracking/X86/lower-to-value.ll
  llvm/test/DebugInfo/assignment-tracking/X86/mem-loc-frag-fill-cfg.ll
  llvm/test/DebugInfo/assignment-tracking/X86/mem-loc-frag-fill.ll
  llvm/test/DebugInfo/assignment-tracking/X86/nested-loop-frags.ll
  llvm/test/DebugInfo/assignment-tracking/X86/use-known-value-at-early-mem-def-2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146980.508683.patch
Type: text/x-patch
Size: 24680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230327/87ecc60f/attachment.bin>


More information about the llvm-commits mailing list