bug fixes

llvm-svn: 36701
This commit is contained in:
Chris Lattner 2007-05-03 22:09:51 +00:00
parent d59084b6f6
commit e144600a5b

View File

@ -400,7 +400,7 @@ bool BitcodeReader::ParseValueSymbolTable() {
switch (Stream.ReadRecord(Code, Record)) { switch (Stream.ReadRecord(Code, Record)) {
default: // Default behavior: unknown type. default: // Default behavior: unknown type.
break; break;
case bitc::TST_CODE_ENTRY: // VST_ENTRY: [valueid, namelen, namechar x N] case bitc::VST_CODE_ENTRY: // VST_ENTRY: [valueid, namelen, namechar x N]
if (ConvertToString(Record, 1, ValueName)) if (ConvertToString(Record, 1, ValueName))
return Error("Invalid TST_ENTRY record"); return Error("Invalid TST_ENTRY record");
unsigned ValueID = Record[0]; unsigned ValueID = Record[0];
@ -1054,7 +1054,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
if (Record.size() < 1 || Record[0] == 0) if (Record.size() < 1 || Record[0] == 0)
return Error("Invalid DECLAREBLOCKS record"); return Error("Invalid DECLAREBLOCKS record");
// Create all the basic blocks for the function. // Create all the basic blocks for the function.
FunctionBBs.resize(Record.size()); FunctionBBs.resize(Record[0]);
for (unsigned i = 0, e = FunctionBBs.size(); i != e; ++i) for (unsigned i = 0, e = FunctionBBs.size(); i != e; ++i)
FunctionBBs[i] = new BasicBlock("", F); FunctionBBs[i] = new BasicBlock("", F);
CurBB = FunctionBBs[0]; CurBB = FunctionBBs[0];
@ -1185,7 +1185,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
} }
return Error("Invalid RET record"); return Error("Invalid RET record");
case bitc::FUNC_CODE_INST_BR: { // BR: [bb#, bb#, opval] or [bb#] case bitc::FUNC_CODE_INST_BR: { // BR: [bb#, bb#, opval] or [bb#]
if (Record.size() != 1 || Record.size() != 3) if (Record.size() != 1 && Record.size() != 3)
return Error("Invalid BR record"); return Error("Invalid BR record");
BasicBlock *TrueDest = getBasicBlock(Record[0]); BasicBlock *TrueDest = getBasicBlock(Record[0]);
if (TrueDest == 0) if (TrueDest == 0)