Simplify code and silence warning
authorChris Lattner <sabre@nondot.org>
Tue, 27 Jul 2004 02:34:49 +0000 (02:34 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 27 Jul 2004 02:34:49 +0000 (02:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15255 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/Reader.cpp

index 6da38dd6c77639189cad4cdc971bba54b5bca93f..3ebd7c88f4d39d533716ccbb585a8306a90e625e 100644 (file)
@@ -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<GlobalValue>(Val))) 
-        error("GlobalValue not in ValueTable!");
+      GlobalValue *GV = dyn_cast<GlobalValue>(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: