From 3a69b22c3d95634002f80e1e491616942e0407d7 Mon Sep 17 00:00:00 2001 From: Mark Seaborn Date: Tue, 25 Jun 2013 21:33:49 -0700 Subject: PNaCl wire format: Remove code for reading old SwitchInst representation The PNaCl pexe writer never writes this old representation. This is part of a cleanup to make forward reference handling stricter: it removes a use of getOrCreateFnValueByID(), which isn't strict (that is, it doesn't reject duplicate FORWARDTYPEREF records). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17764003 --- lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp index bd6ddcb020..0fe72704e0 100644 --- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp +++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp @@ -2184,32 +2184,7 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) { I = SI; break; } - - // Old SwitchInst format without case ranges. - - if (Record.size() < 3 || (Record.size() & 1) == 0) - return Error("Invalid SWITCH record"); - Type *OpTy = getTypeByID(Record[0]); - Value *Cond = getValue(Record, 1, NextValueNo, OpTy); - BasicBlock *Default = getBasicBlock(Record[2]); - if (OpTy == 0 || Cond == 0 || Default == 0) - return Error("Invalid SWITCH record"); - unsigned NumCases = (Record.size()-3)/2; - SwitchInst *SI = SwitchInst::Create(Cond, Default, NumCases); - InstructionList.push_back(SI); - for (unsigned i = 0, e = NumCases; i != e; ++i) { - ConstantInt *CaseVal = - dyn_cast_or_null( - getOrCreateFnValueByID(Record[3+i*2], OpTy)); - BasicBlock *DestBB = getBasicBlock(Record[1+3+i*2]); - if (CaseVal == 0 || DestBB == 0) { - delete SI; - return Error("Invalid SWITCH record!"); - } - SI->addCase(CaseVal, DestBB); - } - I = SI; - break; + return Error("Old SwitchInst representation not supported"); } case naclbitc::FUNC_CODE_INST_INDIRECTBR: { // INDIRECTBR: [opty, op0, op1, ...] if (Record.size() < 2) -- cgit v1.2.3-18-g5258