DAGCombiner: Combine extract_vector_elt from build_vector
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 12 Oct 2015 23:59:50 +0000 (23:59 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 12 Oct 2015 23:59:50 +0000 (23:59 +0000)
commitc08fe15c4f290d18d468f53546a790b7d218a74d
tree33542e1db3de4d4456f73da1fd6e6f07dbd73ef7
parentd779d350372cb1f684d739d5db013085cd2ac8a6
DAGCombiner: Combine extract_vector_elt from build_vector

This basic combine was surprisingly missing.
AMDGPU legalizes many operations in terms of 32-bit vector components,
so not doing this results in many extra copies and subregister extracts
that need to be cleaned up later.

InstCombine already does this for the hasOneUse case. The target hook
is to fix a handful of tests which break (e.g. ARM/vmov.ll) which turn
from a vector materialize repeated immediate instruction to a constant
vector load with more scalar copies from it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250129 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/AMDGPU/AMDGPUISelLowering.cpp
lib/Target/AMDGPU/AMDGPUISelLowering.h
test/CodeGen/AArch64/fold-constants.ll
test/CodeGen/AMDGPU/ds_read2.ll
test/CodeGen/AMDGPU/fceil64.ll
test/CodeGen/AMDGPU/ftrunc.f64.ll
test/CodeGen/AMDGPU/gep-address-space.ll