[llvm] [DebugInfo] Keep validating after register and entry-value ops (PR #214057)
Eric Christopher via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 21:34:25 PDT 2026
echristo wrote:
You’re right that this does not provide complete semantic validation, and DW_OP_reg0, DW_OP_stack_value remains accepted here. I should have been a bit more clear in the patch description.
> Doing some archeological digging, this restores initial code before revert/reland in https://reviews.llvm.org/D60716#
>
It is a little. This is mostly making sure the rest of the expression goes through at least these checks rather than hitting the early return that they were before. Thoughts?
> // DW_OP_regN is a register location description, not a stack operation.
> // DWARF 5 2.6.1.1.3 requires it to stand alone as the whole object or a
> // whole piece of one, so only a fragment may follow.
> if (Op >= dwarf::DW_OP_reg0 && Op <= dwarf::DW_OP_reg31) {
> auto J = I;
> if (++J != E && J->getOp() != dwarf::DW_OP_LLVM_fragment)
> return false;
> continue;
> }
> ```
So, a weird thing happened on the way through the standard. Apparently it changed between 5 and 6 here explicitly - DWARF issue 230524.1 (https://dwarfstd.org/issues/230524.1.html) deliberately changed the rule for DWARF 6 and permits a register location followed by a dereference. So we should probably keep that part flexible here so we don't try to handle dwarf5 v 6 in the verifier?
https://github.com/llvm/llvm-project/pull/214057
More information about the llvm-commits
mailing list