This is an archive of the discontinued LLVM Phabricator instance.

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

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



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.


Diff Detail