OSDN Git Service

[DAGCombiner] When folding (insert_subvector undef, (bitcast (extract_subvector N1...
authorCraig Topper <craig.topper@intel.com>
Thu, 1 Feb 2018 20:48:50 +0000 (20:48 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 1 Feb 2018 20:48:50 +0000 (20:48 +0000)
commit3b21b563edb79a81bb40be0466a6e0057797fc14
tree4f04f320c1923a36eeb676e6396681d029d32d9d
parent514aed67bfd5425c5a54d26b6cdd8407015e6756
[DAGCombiner] When folding (insert_subvector undef, (bitcast (extract_subvector N1, Idx)), Idx) -> (bitcast N1) make sure that N1 has the same total size as the original output

We were only checking the element count, but not the total width. This could cause illegal bitcasts to be created if for example the output was 512-bits, but N1 is 256 bits, and the extraction size was 128-bits.

Fixes PR36199

Differential Revision: https://reviews.llvm.org/D42809

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324002 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/pr36199.ll [new file with mode: 0644]