1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

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

llvm-svn: 59576
This commit is contained in:
Bill Wendling 2008-11-19 01:15:05 +00:00
parent dd2491943e
commit 5a374e2969

View File

@ -1395,8 +1395,18 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty,
if (VT < 0) { if (VT < 0) {
int Match = ~VT; int Match = ~VT;
if (Match == 0) { const Type *RetTy = FTy->getReturnType();
if (Ty != 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 " CheckFailed("Intrinsic parameter #" + utostr(ArgNo - 1) + " does not "
"match return type.", F); "match return type.", F);
return false; return false;