Fix assert in X86 backend.
authorJames Y Knight <jyknight@google.com>
Fri, 9 Oct 2015 20:10:14 +0000 (20:10 +0000)
committerJames Y Knight <jyknight@google.com>
Fri, 9 Oct 2015 20:10:14 +0000 (20:10 +0000)
commit5b8217bc054f19b3f08f8d711151ca0053663e4c
tree0bab9acc6b80317c98944281461713641f178f5b
parenta6e8ebb0d9f45a7e56dc82a814210784b5e891c0
Fix assert in X86 backend.

When running combine on an extract_vector_elt, it wants to look through
a bitcast to check if the argument to the bitcast was itself an
extract_vector_elt with particular operands.

However, it called getOperand() on the argument to the bitcast *before*
checking that the opcode was EXTRACT_VECTOR_ELT, assert-failing if there
were zero operands for the actual opcode.

Fix, and add trivial test.

llvm-svn: 249891
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/Generic/vector.ll