summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-11-19 01:15:05 +0000
committerBill Wendling <isanbard@gmail.com>2008-11-19 01:15:05 +0000
commit9dc0f61a5e8e52f64c014632dc1916451e7c9217 (patch)
treee5781349d502c61a35e1e36e339996c8abe46c13 /llvm/lib
parentd7db9644955fe5a4590b72e7cf5524c5952ea018 (diff)
downloadbcm5719-llvm-9dc0f61a5e8e52f64c014632dc1916451e7c9217.tar.gz
bcm5719-llvm-9dc0f61a5e8e52f64c014632dc1916451e7c9217.zip
Match an element of the return type if it returns a structure.
llvm-svn: 59576
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 86413ed6202..43ecf65f7e4 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud