]> granicus.if.org Git - clang/commit
[AMDGPU] Fix assertion due to initializer list
authorYaxun Liu <Yaxun.Liu@amd.com>
Sun, 20 Oct 2019 15:02:22 +0000 (15:02 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Sun, 20 Oct 2019 15:02:22 +0000 (15:02 +0000)
commitc78da41cdae532adb51d10ed73482642881346dd
tree1698450c830787b8b9ec73eadeafb47a28ccaec5
parente0049ed341a18972e5df69a474c8f3efa71db116
[AMDGPU] Fix assertion due to initializer list

Sometimes a global var is replaced by a different llvm value. clang use GetAddrOfGlobalVar to get the original llvm global variable.
For most targets, GetAddrOfGlobalVar returns either the llvm global variable or a bitcast of the llvm global variable.
However, for AMDGPU target, GetAddrOfGlobalVar returns the addrspace cast or addrspace cast plus bitcast of the llvm global variable.
To get the llvm global variable, these casts need to be stripped, otherwise there is assertion.

This patch fixes that.

Differential Revision: https://reviews.llvm.org/D69129

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375362 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/cxx11-extern-constexpr.cpp