Match an element of the return type if it returns a structure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59576 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2008-11-19 01:15:05 +00:00
parent fb5fd5a0bb
commit bccdcca7d1

View File

@ -1395,8 +1395,18 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty,
if (VT < 0) {
int Match = ~VT;
if (Match == 0) {
if (Ty != FTy->getReturnType()) {
const Type *RetTy = FTy->getReturnType();
const StructType *ST = cast<StructType>(RetTy);
unsigned NumRets = 1;
if (ST)
NumRets = ST->getNumElements();
if (Match <= static_cast<int>(NumRets - 1)) {
if (ST)
RetTy = ST->getElementType(Match);
if (Ty != RetTy) {
CheckFailed("Intrinsic parameter #" + utostr(ArgNo - 1) + " does not "
"match return type.", F);
return false;