diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 6da38dd6c77..3ebd7c88f4d 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -1401,16 +1401,14 @@ Constant *BytecodeReader::ParseConstantValue(unsigned TypeID) { // Check to see if we have already read this global variable... Value *Val = getValue(TypeID, Slot, false); - GlobalValue *GV; if (Val) { - if (!(GV = dyn_cast(Val))) - error("GlobalValue not in ValueTable!"); + GlobalValue *GV = dyn_cast(Val); + if (!GV) error("GlobalValue not in ValueTable!"); + if (Handler) Handler->handleConstantPointer(PT, Slot, GV); + return GV; } else { error("Forward references are not allowed here."); } - - if (Handler) Handler->handleConstantPointer(PT, Slot, GV ); - return GV; } default: