implement the 'string constant' optimization. This shrinks kc.bit from

2878544 to 2815788


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36818 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-05-06 00:35:24 +00:00
parent abfbf85004
commit ff7fc5dabe
4 changed files with 34 additions and 12 deletions

View File

@ -642,7 +642,21 @@ bool BitcodeReader::ParseConstants() {
}
break;
}
case bitc::CST_CODE_STRING: { // STRING: [values]
if (Record.empty())
return Error("Invalid CST_AGGREGATE record");
const ArrayType *ATy = cast<ArrayType>(CurTy);
const Type *EltTy = ATy->getElementType();
unsigned Size = Record.size();
std::vector<Constant*> Elts;
for (unsigned i = 0; i != Size; ++i)
Elts.push_back(ConstantInt::get(EltTy, Record[i]));
V = ConstantArray::get(ATy, Elts);
break;
}
case bitc::CST_CODE_CE_BINOP: { // CE_BINOP: [opcode, opval, opval]
if (Record.size() < 3) return Error("Invalid CE_BINOP record");
int Opc = GetDecodedBinaryOpcode(Record[0], CurTy);