[llvm-commits] [llvm] r59576 - /llvm/trunk/lib/VMCore/Verifier.cpp

Bill Wendling isanbard at gmail.com
Tue Nov 18 17:15:05 PST 2008


Author: void
Date: Tue Nov 18 19:15:05 2008
New Revision: 59576

URL: http://llvm.org/viewvc/llvm-project?rev=59576&view=rev
Log:
Match an element of the return type if it returns a structure.

Modified:
    llvm/trunk/lib/VMCore/Verifier.cpp

Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=59576&r1=59575&r2=59576&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Tue Nov 18 19:15:05 2008
@@ -1395,8 +1395,18 @@
 
   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;





More information about the llvm-commits mailing list