[PATCH] D31604: [DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 10:03:15 PDT 2017


andrewng added inline comments.


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:559
+      SmallVector<uint64_t, 8> Elements(OrigElements.size() + 1);
+      Elements[0] = dwarf::DW_OP_stack_value;
+      std::copy(OrigElements.begin(), OrigElements.end(),
----------------
aprantl wrote:
> andrewng wrote:
> > aprantl wrote:
> > > Are you sure you want the DW_OP_stack_value at position 0? Shouldn't it go either at the end of the expression or just before a DW_OP_llvm_fragment operation?
> > Yes, I think it needs to be there otherwise any existing operations will be operating on the wrong value.
> Sorry, this was a rhetorical question. The DW_OP_stack_value operation always terminates the expression. It *must* come at the end (but before DW_OP_LLVM_fragement). You can factor out the code in Local.cpp from prependDIExpr() and move it into a static member function of DIExpression.
Thanks for the clarification. I re-read the spec more carefully and yes, I missed the "terminates the expression" part.

I've had a quick look at prependDIExpr. Could I use the offset to apply my AddrDispShift? Will the backend then sort out the specifics of generating a "correct" DWARF expression?

I think it is somewhat confusing that the DIExpression uses DWARF operations, but isn't strictly the equivalent of a DWARF expression. Or have I misunderstood?


https://reviews.llvm.org/D31604





More information about the llvm-commits mailing list