This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][InstrRef] Permit and track variable assignments in out-of-scope blocks
ClosedPublic

Authored by jmorse on Nov 25 2021, 3:55 AM.

Details

Summary

Allow and track variable assignments that happen in blocks that are out-of-scope. This happens when a DBG_INSTR_REF or DBG_VALUE gets moved to a block where no instructions are in its lexical scope, or the instructions in-scope are moved / merged so that the block is no longer in scope.

What to do in the general case is arguable -- LiveDebugValues already loses some variable locations due to its scope trimming, see PR48091 -- but the scope trimming is necessary for performance reasons. There's already a test though, llvm/test/DebugInfo/X86/stack-value-dwarf2.ll , that depends on assignments in out-of-scope blocks being preserved, so lets preserved VarLoc LiveDebugValues' behaviour for now. I ran it through the compile-time-tracker [0] and its performance effects are fractional.

[0] http://llvm-compile-time-tracker.com/compare.php?from=83be083d8567316ff2dd6e9651009cc2d615a69a&to=fbcd0356ed20c959cba82b1d710d97ef40b7e547&stat=instructions

Diff Detail