Fix a bug that prevents global variables from having a DW_OP_deref.
authorAdrian Prantl <aprantl@apple.com>
Fri, 27 Apr 2018 22:05:31 +0000 (22:05 +0000)
committerAdrian Prantl <aprantl@apple.com>
Fri, 27 Apr 2018 22:05:31 +0000 (22:05 +0000)
commit4b542c6e64a07577d3cf445065cee75fa2221935
tree54fb712fbeecea0227e10c4c4e2cfd273bcaecd7
parentbefce13328be3c0a4762adf26b0dd6a54e5592f5
Fix a bug that prevents global variables from having a DW_OP_deref.

For local variables the first DW_OP_deref is consumed by turning the
location kind into a memeory location, but that only makes sense for
values that are in a register to begin with, which cannot happen for
global variables that are attached to a symbol.

rdar://problem/39741860

This reapplies r330970 after fixing an uncovered bug in r331086 and
working around the situation caused by it.

llvm-svn: 331090
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
llvm/test/DebugInfo/X86/global-expression.ll [new file with mode: 0644]