Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Unified Diff: lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp

Issue 270723003: PNaCl SIMD: allow the bitcode reader to read select instructions properly (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/NaCl/Bitcode/vector.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | test/NaCl/Bitcode/vector.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698