AMDGPU: Add combine for trunc of bitcast from build_vector
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 9 May 2018 18:37:39 +0000 (18:37 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 9 May 2018 18:37:39 +0000 (18:37 +0000)
commit762d49880876eca14aa75a1bc893eba23ed50788
tree2d8e059a73d5b7c2f2e60458e71e2503e58dadad
parent73634e40378fdba2b39c777a871961af2651b4e0
AMDGPU: Add combine for trunc of bitcast from build_vector

If the truncate is only accessing the first element of the vector,
we can use the original source value.

This helps with some combine ordering issues after operations are
lowered to integer operations between bitcasts of build_vector.
In particular it stops unnecessarily materializing the unused
top half of a vector in some cases.

llvm-svn: 331909
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
llvm/test/CodeGen/AMDGPU/function-returns.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.gather4.d16.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.d16.ll
llvm/test/CodeGen/AMDGPU/store-weird-sizes.ll
llvm/test/CodeGen/AMDGPU/trunc-combine.ll [new file with mode: 0644]