[DAGCombiner] Avoid calling method 'isShuffleMaskLegal' on illegal vector types.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Tue, 15 Jul 2014 00:02:32 +0000 (00:02 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Tue, 15 Jul 2014 00:02:32 +0000 (00:02 +0000)
commit217cd18656a903c5941e80182bd10a96343116e9
treee804e2c1e386f9678dec16d8f264b1fa955e8bb9
parentb7df516d1fbdf1552b68c9931a8c7f82f73f8ed2
[DAGCombiner] Avoid calling method 'isShuffleMaskLegal' on illegal vector types.

This patch fixes a crasher in method 'DAGCombiner::visitOR' due to an invalid
call to method 'isShuffleMaskLegal'. On x86, method 'isShuffleMaskLegal'
always expects a legal vector value type in input.

With this patch, we immediately check if the input OR dag node has a legal
vector type; we only try to fold a OR dag node into a single shufflevector
if we know that the resulting shuffle will have a legal type.
This is to avoid calling method 'isShuffleMaskLegal' on a potentially
illegal vector value type.

Added a new test-case to file 'CodeGen/X86/combine-or.ll' to verify that
DAGCombiner doesn't crash in the attempt to check/combine an OR between shuffles
with illegal types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213020 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/combine-or.ll