[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)
commit2620b877b6299e04767718358d6e1eb66b18cb49
treebb621c48a96bd87f0041d9174933c0553f8da29b
parent5c53298c1eca22b512c43b2cf02e5e9f05c136a1
[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
}

llvm-svn: 212498
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/pshufd-combine-crash.ll [new file with mode: 0644]