diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-11-19 01:15:05 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-11-19 01:15:05 +0000 |
commit | bccdcca7d19f65ada4477c2f3eedc0fd5f690adf (patch) | |
tree | c74c489b127f8a7d6393a434c68f3945d53c82f6 /lib/VMCore/Verifier.cpp | |
parent | fb5fd5a0bb5f81acda6d04d69c20d49ef06a36f0 (diff) | |
download | external_llvm-bccdcca7d19f65ada4477c2f3eedc0fd5f690adf.zip external_llvm-bccdcca7d19f65ada4477c2f3eedc0fd5f690adf.tar.gz external_llvm-bccdcca7d19f65ada4477c2f3eedc0fd5f690adf.tar.bz2 |
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
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 86413ed..43ecf65 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -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; |