[stack protector] Look through bitcasts to get global variable
authorAkira Hatanaka <ahatanaka@apple.com>
Thu, 7 Aug 2014 23:08:24 +0000 (23:08 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Thu, 7 Aug 2014 23:08:24 +0000 (23:08 +0000)
commit43f6ce92898ae6edcb4070721fc780192eee9662
treec4e8e691dd5007e9f7c97fa252caafd7bac6b289
parent7f48f056f7b3e125b65af2e6c9042008073c97d7
[stack protector] Look through bitcasts to get global variable
__stack_chk_guard.

Handle the case where the pointer operand of the load instruction that loads the
stack guard is not a global variable but instead a bitcast.

%StackGuard = load i8** bitcast (i64** @__stack_chk_guard to i8**)
call void @llvm.stackprotector(i8* %StackGuard, i8** %StackGuardSlot)

Original test case provided by Ana Pazos.

This fixes PR20558.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215167 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
test/CodeGen/AArch64/stack-guard-remat-bitcast.ll [new file with mode: 0644]