Check struct return type first.
authorDevang Patel <dpatel@apple.com>
Wed, 5 Mar 2008 00:27:05 +0000 (00:27 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 5 Mar 2008 00:27:05 +0000 (00:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47922 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 9ce886cd86279bf447b7b771e5954d554b9c26d1..01a4a941efe4a08b3a552c7c79463c08750a1d3d 100644 (file)
@@ -581,18 +581,19 @@ void Verifier::visitReturnInst(ReturnInst &RI) {
     Assert2(F->getReturnType() == Type::VoidTy,
             "Found return instr that returns void in Function of non-void "
             "return type!", &RI, F->getReturnType());
-  else if (N == 1)
-    Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
-            "Function return type does not match operand "
-            "type of return inst!", &RI, F->getReturnType());
   else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
     for (unsigned i = 0; i < N; i++)
       Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(),
               "Function return type does not match operand "
               "type of return inst!", &RI, F->getReturnType());
-  } else
+  } 
+  else if (N == 1) 
+    Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
+            "Function return type does not match operand "
+            "type of return inst!", &RI, F->getReturnType());
+  else
     Assert1(0, "Invalid return type!", &RI);
-
+  
   // Check to make sure that the return value has necessary properties for
   // terminators...
   visitTerminatorInst(RI);