summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-06-08 05:54:47 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-06-08 05:54:47 +0000
commit42427f0ccbc8fd8bccfd7ad32229f6adb62bd423 (patch)
tree72e9789e1db0a5de83d9bc0a7bc6c39117067c50 /llvm/lib/Bytecode/Reader
parent2c5613d1c3ad9e1e6b81da54486a90529b030883 (diff)
downloadbcm5719-llvm-42427f0ccbc8fd8bccfd7ad32229f6adb62bd423.tar.gz
bcm5719-llvm-42427f0ccbc8fd8bccfd7ad32229f6adb62bd423.zip
Fix the bug that was preventing the parser from working on all bytecode
files. It was reading non-initialized global vars when the flag said it was initialized and vice versa. Causes mis-alignment since initialized and non-initialized constants have different bytecode lengths. llvm-svn: 14057
Diffstat (limited to 'llvm/lib/Bytecode/Reader')
-rw-r--r--llvm/lib/Bytecode/Reader/Parser.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Bytecode/Reader/Parser.cpp b/llvm/lib/Bytecode/Reader/Parser.cpp
index d236b64aae2..45f761ea677 100644
--- a/llvm/lib/Bytecode/Reader/Parser.cpp
+++ b/llvm/lib/Bytecode/Reader/Parser.cpp
@@ -156,7 +156,8 @@ void AbstractBytecodeParser::ParseBasicBlock(BufPtr &Buf,
/// ParseInstructionList - Parse all of the BasicBlock's & Instruction's in the
/// body of a function. In post 1.0 bytecode files, we no longer emit basic
/// block individually, in order to avoid per-basic-block overhead.
-unsigned AbstractBytecodeParser::ParseInstructionList( BufPtr &Buf, BufPtr EndBuf) {
+unsigned AbstractBytecodeParser::ParseInstructionList( BufPtr &Buf,
+ BufPtr EndBuf) {
unsigned BlockNo = 0;
std::vector<unsigned> Args;
@@ -698,12 +699,11 @@ void AbstractBytecodeParser::ParseModuleGlobalInfo(BufPtr &Buf, BufPtr End) {
const Type *ElTy = cast<PointerType>(Ty)->getElementType();
// Create the global variable...
- if (hasInitializer)
- handler->handleGlobalVariable( ElTy, isConstant, Linkage );
- else {
+ if (hasInitializer) {
unsigned initSlot = read_vbr_uint(Buf,End);
handler->handleInitializedGV( ElTy, isConstant, Linkage, initSlot );
- }
+ } else
+ handler->handleGlobalVariable( ElTy, isConstant, Linkage );
// Get next item
VarType = read_vbr_uint(Buf, End);
OpenPOWER on IntegriCloud