Skip to content

Commit b3ca38c

Browse files
author
Devang Patel
committed
Check struct return type first.
llvm-svn: 47922
1 parent 31672db commit b3ca38c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

llvm/lib/VMCore/Verifier.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,18 +581,19 @@ void Verifier::visitReturnInst(ReturnInst &RI) {
581581
Assert2(F->getReturnType() == Type::VoidTy,
582582
"Found return instr that returns void in Function of non-void "
583583
"return type!", &RI, F->getReturnType());
584-
else if (N == 1)
585-
Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
586-
"Function return type does not match operand "
587-
"type of return inst!", &RI, F->getReturnType());
588584
else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
589585
for (unsigned i = 0; i < N; i++)
590586
Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(),
591587
"Function return type does not match operand "
592588
"type of return inst!", &RI, F->getReturnType());
593-
} else
589+
}
590+
else if (N == 1)
591+
Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
592+
"Function return type does not match operand "
593+
"type of return inst!", &RI, F->getReturnType());
594+
else
594595
Assert1(0, "Invalid return type!", &RI);
595-
596+
596597
// Check to make sure that the return value has necessary properties for
597598
// terminators...
598599
visitTerminatorInst(RI);

0 commit comments

Comments
 (0)