[PATCH] D99900: [llvm] [testsuite] Fix invalid DW_AT_location DWARF expression in unattached-global.ll

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 8 10:35:22 PDT 2021


dblaikie added a comment.

In D99900#2677183 <https://reviews.llvm.org/D99900#2677183>, @aprantl wrote:

> Maybe I'm missing something but it looks to me like this test is supposed to test that we don't attach DW_AT_location to a variable that has been optimized out.
>
> This test is what you get after optimizing away
>
>   someglobal = i32 ..., !dbg !3
>
> and I don't think it is invalid at all. Since it doesn't hold a constant, the DIExpression is meaningless without being attached to a global, but it's not invalid IR. It just shouldn't get output in DWARF.
>
> This going to get less ambiguous with the ongoing work to make arguments in DIExpressions more explicit.

How'd this expression get in the "globals" list, then? Shouldn't the globals list only contain constants? Any DIGlobalVariableExpression would only be referenced via the dbg.value? Oh, it is referenced from both places. That seems unfortunate/wasn't my understanding - I'd have thought that we would either reference the DIGlobalVariableExpression from the dbg.value or from the globals list, not both at the same time (because one referenced from one place doesn't make sense when referenced from the other place - due to lack of the implicit parameter).

In any case, clearly my understanding is off from the current reality & yeah, I agree with your assessment @aprantl & so this change isn't correct & I guess we'll abandon this change and go back to the other review to discuss the issue there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99900



More information about the llvm-commits mailing list