Teach DAGCombiner how to fold a SIGN_EXTEND_INREG of a BUILD_VECTOR of
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 27 Dec 2013 20:20:28 +0000 (20:20 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 27 Dec 2013 20:20:28 +0000 (20:20 +0000)
commitb2f47c6a3455a9d265e21c8ab1ca81657ff577a0
treecfaadbd40840df2293deec78b068ce832fafb91f
parentbd75475bfcbf81c0f6e3a67511c16704c7da8b7a
Teach DAGCombiner how to fold a SIGN_EXTEND_INREG of a BUILD_VECTOR of
ConstantSDNodes (or UNDEFs) into a simple BUILD_VECTOR.

For example, given the following sequence of dag nodes:

  i32 C = Constant<1>
  v4i32 V = BUILD_VECTOR C, C, C, C
  v4i32 Result = SIGN_EXTEND_INREG V, ValueType:v4i1

The SIGN_EXTEND_INREG node can be folded into a build_vector since
the vector in input is a BUILD_VECTOR of constants.

The optimized sequence is:

  i32 C = Constant<-1>
  v4i32 Result = BUILD_VECTOR C, C, C, C

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198084 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/2011-12-28-vselecti8.ll
test/CodeGen/X86/blend-msb.ll
test/CodeGen/X86/sse2-blend.ll
test/CodeGen/X86/vselect.ll [new file with mode: 0644]