From e089160d1065d83986fd97fae7f0af08c03e7d47 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 21 Jul 2008 23:30:30 +0000 Subject: InsertValue and ExtractValue constant expressions are always folded. Remove code that handled the case where they aren't folded, and remove bitcode reader/writer support for them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53887 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/BitcodeReader.cpp | 41 ------------------------------------ lib/Bitcode/Writer/BitcodeWriter.cpp | 20 ------------------ 2 files changed, 61 deletions(-) (limited to 'lib/Bitcode') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index a8c62be..3e2af4f 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -770,47 +770,6 @@ bool BitcodeReader::ParseConstants() { V = ConstantExpr::getGetElementPtr(Elts[0], &Elts[1], Elts.size()-1); break; } - case bitc::CST_CODE_CE_EXTRACTVAL: { - // CE_EXTRACTVAL: [opty, opval, n x indices] - const Type *AggTy = getTypeByID(Record[0]); - if (!AggTy || !AggTy->isAggregateType()) - return Error("Invalid CE_EXTRACTVAL record"); - Constant *Agg = ValueList.getConstantFwdRef(Record[1], AggTy); - SmallVector Indices; - for (unsigned i = 2, e = Record.size(); i != e; ++i) { - uint64_t Index = Record[i]; - if ((unsigned)Index != Index) - return Error("Invalid CE_EXTRACTVAL record"); - Indices.push_back((unsigned)Index); - } - if (!ExtractValueInst::getIndexedType(AggTy, - Indices.begin(), Indices.end())) - return Error("Invalid CE_EXTRACTVAL record"); - V = ConstantExpr::getExtractValue(Agg, &Indices[0], Indices.size()); - break; - } - case bitc::CST_CODE_CE_INSERTVAL: { - // CE_INSERTVAL: [opty, opval, opty, opval, n x indices] - const Type *AggTy = getTypeByID(Record[0]); - if (!AggTy || !AggTy->isAggregateType()) - return Error("Invalid CE_INSERTVAL record"); - Constant *Agg = ValueList.getConstantFwdRef(Record[1], AggTy); - const Type *ValTy = getTypeByID(Record[2]); - Constant *Val = ValueList.getConstantFwdRef(Record[3], ValTy); - SmallVector Indices; - for (unsigned i = 4, e = Record.size(); i != e; ++i) { - uint64_t Index = Record[i]; - if ((unsigned)Index != Index) - return Error("Invalid CE_INSERTVAL record"); - Indices.push_back((unsigned)Index); - } - if (ExtractValueInst::getIndexedType(AggTy, - Indices.begin(), - Indices.end()) != ValTy) - return Error("Invalid CE_INSERTVAL record"); - V = ConstantExpr::getInsertValue(Agg, Val, &Indices[0], Indices.size()); - break; - } case bitc::CST_CODE_CE_SELECT: // CE_SELECT: [opval#, opval#, opval#] if (Record.size() < 3) return Error("Invalid CE_SELECT record"); V = ConstantExpr::getSelect(ValueList.getConstantFwdRef(Record[0], diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 9794fac..f4d7359 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -611,26 +611,6 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Record.push_back(VE.getValueID(C->getOperand(i))); } break; - case Instruction::ExtractValue: { - Code = bitc::CST_CODE_CE_EXTRACTVAL; - Record.push_back(VE.getTypeID(C->getOperand(0)->getType())); - Record.push_back(VE.getValueID(C->getOperand(0))); - const SmallVector &Indices = CE->getIndices(); - for (unsigned i = 0, e = Indices.size(); i != e; ++i) - Record.push_back(Indices[i]); - break; - } - case Instruction::InsertValue: { - Code = bitc::CST_CODE_CE_INSERTVAL; - Record.push_back(VE.getTypeID(C->getOperand(0)->getType())); - Record.push_back(VE.getValueID(C->getOperand(0))); - Record.push_back(VE.getTypeID(C->getOperand(1)->getType())); - Record.push_back(VE.getValueID(C->getOperand(1))); - const SmallVector &Indices = CE->getIndices(); - for (unsigned i = 0, e = Indices.size(); i != e; ++i) - Record.push_back(Indices[i]); - break; - } case Instruction::Select: Code = bitc::CST_CODE_CE_SELECT; Record.push_back(VE.getValueID(C->getOperand(0))); -- cgit v1.1