Index: lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp |
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp |
index 2071d4496f77cc319d92af1b685e0ffe0cab43ea..2bb04b6e8a53b717daf54774e8035a7fbe630ec4 100644 |
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp |
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp |
@@ -1172,9 +1172,17 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) { |
TrueVal = ConvertOpToScalar(TrueVal, CurBBNo); |
FalseVal = ConvertOpToScalar(FalseVal, CurBBNo); |
- // expect i1 |
- if (Cond->getType() != Type::getInt1Ty(Context)) |
- return Error("Invalid SELECT condition type"); |
+ // select condition can be either i1 or [N x i1] |
+ if (VectorType* vector_type = |
+ dyn_cast<VectorType>(Cond->getType())) { |
+ // expect <n x i1> |
+ if (vector_type->getElementType() != Type::getInt1Ty(Context)) |
+ return Error("Invalid SELECT vector condition type"); |
+ } else { |
+ // expect i1 |
+ if (Cond->getType() != Type::getInt1Ty(Context)) |
+ return Error("Invalid SELECT condition type"); |
+ } |
I = SelectInst::Create(Cond, TrueVal, FalseVal); |
break; |