From 3beb037fee2d77e09a96fbd5a507a2eeea7e860e Mon Sep 17 00:00:00 2001 From: Karl Schimpf Date: Mon, 29 Jul 2013 08:41:58 -0700 Subject: Remove handling of nongenerable instructions in PNaCl reader. The PNaCl bitcode writer doesn't generate certain forms of instructions that the PNaCl bitcode writer accepts. Since these instructions do not get generated, remove them from the bitcode reader. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/20442002 --- lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp | 36 +++------------------------ 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp') diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp index b384df7f58..9c2f45ea56 100644 --- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp +++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp @@ -29,10 +29,6 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; -enum { - SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex -}; - void NaClBitcodeReader::FreeState() { if (BufferOwned) delete Buffer; @@ -1443,20 +1439,6 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) { break; } - case naclbitc::FUNC_CODE_INST_SELECT: { // SELECT: [opval, opval, opval] - // obsolete form of select - // handles select i1 ... in old bitcode - unsigned OpNum = 0; - Value *TrueVal, *FalseVal, *Cond; - if (popValue(Record, &OpNum, NextValueNo, &TrueVal) || - popValue(Record, &OpNum, NextValueNo, &FalseVal) || - popValue(Record, &OpNum, NextValueNo, &Cond)) - return Error("Invalid SELECT record"); - - I = SelectInst::Create(Cond, TrueVal, FalseVal); - break; - } - case naclbitc::FUNC_CODE_INST_VSELECT: {// VSELECT: [opval, opval, pred] // new form of select // handles select i1 or select [N x i1] @@ -1467,26 +1449,14 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) { popValue(Record, &OpNum, NextValueNo, &Cond)) return Error("Invalid SELECT record"); - // select condition can be either i1 or [N x i1] - if (VectorType* vector_type = - dyn_cast(Cond->getType())) { - // expect - if (vector_type->getElementType() != Type::getInt1Ty(Context)) - return Error("Invalid SELECT condition type"); - } else { - // expect i1 - if (Cond->getType() != Type::getInt1Ty(Context)) - return Error("Invalid SELECT condition type"); - } + // expect i1 + if (Cond->getType() != Type::getInt1Ty(Context)) + return Error("Invalid SELECT condition type"); I = SelectInst::Create(Cond, TrueVal, FalseVal); break; } - case naclbitc::FUNC_CODE_INST_CMP: // CMP: [opval, opval, pred] - // Old form of ICmp/FCmp returning bool - // Existed to differentiate between icmp/fcmp and vicmp/vfcmp which were - // both legal on vectors but had different behaviour. case naclbitc::FUNC_CODE_INST_CMP2: { // CMP2: [opval, opval, pred] // FCmp/ICmp returning bool or vector of bool -- cgit v1.2.3-18-g5258