CodeGen: Let frame index value type match alloca addr space
authorYaxun Liu <Yaxun.Liu@amd.com>
Thu, 20 Apr 2017 18:15:34 +0000 (18:15 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Thu, 20 Apr 2017 18:15:34 +0000 (18:15 +0000)
commit5d977f8ed4944a6b394ec2dc1131b7f1f0087759
tree372e6243f92a9ad2acb6e58230b5349097ca4677
parent62731e1c891c6decfc2bbe6fe868feee2eda6d83
CodeGen: Let frame index value type match alloca addr space

Recently alloca address space has been added to data layout. Due to this
change, pointer returned by alloca may have different size as pointer in
address space 0.

However, currently the value type of frame index is assumed to be of the
same size as pointer in address space 0.

This patch fixes that.

Most targets assume alloca returning pointer in address space 0, which
is the default alloca address space. Therefore it is NFC for them.

AMDGCN target with amdgiz environment requires this change since it
assumes alloca returning pointer to addr space 5 and its size is 32,
which is different from the size of pointer in addr space 0 which is 64.

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

llvm-svn: 300864
llvm/include/llvm/Target/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/AMDGPU/frame-index-amdgiz.ll [new file with mode: 0644]