summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-03-05 00:27:05 +0000
committerDevang Patel <dpatel@apple.com>2008-03-05 00:27:05 +0000
commit45e99e4f297d118c5dc9afe150b13672ebae2701 (patch)
tree9cf0b2f5429643a372ba92e93dc1e02d7730bfd9 /lib
parent2b5fab67c1a2d3ec1184c065e0a6bdaaaec9253a (diff)
downloadllvm-45e99e4f297d118c5dc9afe150b13672ebae2701.tar.gz
llvm-45e99e4f297d118c5dc9afe150b13672ebae2701.tar.bz2
llvm-45e99e4f297d118c5dc9afe150b13672ebae2701.tar.xz
Check struct return type first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Verifier.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 9ce886cd86..01a4a941ef 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -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);