[PATCH] D31440: PR32382: Adapt to LLVM changes in DIExpression.

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 3 14:00:50 PDT 2017


dblaikie added a comment.

In https://reviews.llvm.org/D31440#713396, @aprantl wrote:

> In https://reviews.llvm.org/D31440#713308, @dblaikie wrote:
>
> > I'm a bit confused - the alloca was only emitted at -O0, by the looks of it. Presumably it's pessimizing in some way at higher optimization levels? Or is that not the case?
>
>
> I think it is really working around the odd behavior of LLVM here. What gives it away is the we key the addition of the extra DW_OP_deref on whether it is an alloca or not. But note that this is not how dbg.declare works: dbg.declare(%alloca, !DIExpression()) is (kind of) equivalent to dbg.value(%alloca, !DIExpression(DW_OP_deref)). So we are using the presence of the alloca as a proxy for how the backend happens to compile the DwarfExpression here and work around its idiosyncrasy by emitting an extra DW_OP_deref.


I'm still not really following, sorry - perhaps it'd help me if you could describe the state of things in ToT currently, the state this change attempts to create, and the state (if distinct from the previous) that might be ideal. (it's not clear to me if there's still a "workaround" after your change - sounds like there should be/is, if previously there was no alloca above O0 but after this change there will be... )

> 
> 
>> Also, it looks like this change lost the "if > gmlt" test, so might cause variable declarations (& thus types) to leak into GMLT, which is undesirable.
> 
> Oh.. that was unintentional collateral damage. Thanks for noticing!




https://reviews.llvm.org/D31440





More information about the cfe-commits mailing list