Add a test for the foldSelectICmpAndOr fix committed in r180779.
[oota-llvm.git] / test / Transforms / InstCombine / vector-type.ll
1 ; The code in InstCombiner::FoldSelectOpOp was calling
2 ; Type::getVectorNumElements without checking first if the type was a vector.
3
4 ; RUN: opt < %s -instcombine -S
5
6 define i32 @vselect1(i32 %a.coerce, i32 %b.coerce, i32 %c.coerce) {
7 entry:
8   %0 = bitcast i32 %a.coerce to <2 x i16>
9   %1 = bitcast i32 %b.coerce to <2 x i16>
10   %2 = bitcast i32 %c.coerce to <2 x i16>
11   %cmp = icmp sge <2 x i16> %2, zeroinitializer
12   %or = select <2 x i1> %cmp, <2 x i16> %0, <2 x i16> %1
13   %3 = bitcast <2 x i16> %or to i32
14   ret i32 %3
15 }