[x86] Fix assertion failure caused by a wrong combine of PSHUFD nodes with different...
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 7 Jul 2014 23:25:23 +0000 (23:25 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 7 Jul 2014 23:25:23 +0000 (23:25 +0000)
commitcfb83b7bac18c4ee84a3c6b4e0abffc12d08cd5f
tree9a72c8377707c960177a77e014eef78c59f6ce40
parent7cdff793f2a343d3f97ff0c64883ed8cffe7cbfe
[x86] Fix assertion failure caused by a wrong combine of PSHUFD nodes with different types.

When combining a sequence of two PSHUFD dag nodes into a single PSHUFD,
make sure that we assign the correct type to the resulting PSHUFD.
X86ISD::PSHUFD dag nodes can be either MVT::v4i32 or MVT::v4f32.

Before this change, an assertion failure was triggered in method
'DAGCombinerInfo::CombineTo' when trying to combine the shuffles from the test
below into a single PSHUFD.

define <4 x float> @test1(<4 x float> %V) {
  %1 = shufflevector <4 x float> %V, <4 x float> undef, <4 x i32> <i32 3, i32 0, i32 2, i32 1>
  %2 = shufflevector <4 x float> %1, <4 x float> undef, <4 x i32> <i32 3, i32 0, i32 2, i32 1>
  ret <4 x float> %2
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212498 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/pshufd-combine-crash.ll [new file with mode: 0644]