[PATCH] D123599: [DebugInfo][InstrRef] Describe value sizes when spilt to stack

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 09:46:38 PDT 2022


jmorse planned changes to this revision.
jmorse added a comment.

Stone the crows, of the Dexter tests we have that originally detected this problem, another has found a problem in this patch -- for values defined in a stack slot, InstrRefBasedLDV currently guesses the size [0] because it can't work it out so late in compilation. In a piece of code dealing with vectors:

- The variable is a "vector" class with a single array of 4 f32's, that get promoted and vectorised it seems,
- The vectorised value is subject to a PHI at some point,
- A DBG_INSTR_REF refers to the PHI,
- This becomes a DBG_PHI referring to a stack slot after regalloc,
- The code in [0] guesses that the stack slot contains 64 bits, where in reality it's 128 bits,
- 64 bits is not the size of the variable, so a DW_OP_deref_size and DW_OP_stack_value is used, and we lose half the vector.

I think this can be solved by baking a "value size" into DBG_PHIs that refer to the stack: the register allocator knows the register class of the value spilt. We don't need to know the size of values in stack slots at any time other than when a DBG_PHI refers to it, as that's the only way DBG_INSTR_REFs can refer to stack locations. (Except for fused memory operands, which come with a size anyway...). Anyhoo, that's another patch, and more testing.

[0] https://github.com/llvm/llvm-project/blob/12a2f7494e745eb4c90133ea17cadac3a8eb8d07/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp#L1296


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123599/new/

https://reviews.llvm.org/D123599



More information about the llvm-commits mailing list