[llvm-commits] [llvm] r47425 - in /llvm/trunk: lib/VMCore/Value.cpp lib/VMCore/Verifier.cpp test/Assembler/2008-02-20-MultipleReturnValue.ll

Devang Patel dpatel at apple.com
Wed Feb 20 18:14:02 PST 2008


Author: dpatel
Date: Wed Feb 20 20:14:01 2008
New Revision: 47425

URL: http://llvm.org/viewvc/llvm-project?rev=47425&view=rev
Log:
Let invoke return aggregate value.

Modified:
    llvm/trunk/lib/VMCore/Value.cpp
    llvm/trunk/lib/VMCore/Verifier.cpp
    llvm/trunk/test/Assembler/2008-02-20-MultipleReturnValue.ll

Modified: llvm/trunk/lib/VMCore/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=47425&r1=47424&r2=47425&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Value.cpp (original)
+++ llvm/trunk/lib/VMCore/Value.cpp Wed Feb 20 20:14:01 2008
@@ -34,7 +34,7 @@
 Value::Value(const Type *ty, unsigned scid)
   : SubclassID(scid), SubclassData(0), Ty(checkType(ty)),
     UseList(0), Name(0) {
-  if (isa<CallInst>(this))
+  if (isa<CallInst>(this) || isa<InvokeInst>(this))
     assert((Ty->isFirstClassType() || Ty == Type::VoidTy ||
             isa<OpaqueType>(ty) || Ty->getTypeID() == Type::StructTyID) &&
            "invalid CallInst  type!");

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

==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Feb 20 20:14:01 2008
@@ -1072,7 +1072,8 @@
   // Check that the return value of the instruction is either void or a legal
   // value type.
   Assert1(I.getType() == Type::VoidTy || I.getType()->isFirstClassType()
-          || (isa<CallInst>(I) && I.getType()->getTypeID() == Type::StructTyID),
+          || ((isa<CallInst>(I) || isa<InvokeInst>(I))
+              && I.getType()->getTypeID() == Type::StructTyID),
           "Instruction returns a non-scalar type!", &I);
 
   // Check that all uses of the instruction, if they are instructions
@@ -1096,7 +1097,7 @@
       if (isa<ReturnInst>(I) || isa<GetResultInst>(I))
         Assert1(I.getOperand(i)->getType()->getTypeID() == Type::StructTyID,
                 "Invalid ReturnInst operands!", &I);
-      else if (isa<CallInst>(I)) {
+      else if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
         if (const PointerType *PT = dyn_cast<PointerType>
             (I.getOperand(i)->getType())) {
           const Type *ETy = PT->getElementType();

Modified: llvm/trunk/test/Assembler/2008-02-20-MultipleReturnValue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-02-20-MultipleReturnValue.ll?rev=47425&r1=47424&r2=47425&view=diff

==============================================================================
--- llvm/trunk/test/Assembler/2008-02-20-MultipleReturnValue.ll (original)
+++ llvm/trunk/test/Assembler/2008-02-20-MultipleReturnValue.ll Wed Feb 20 20:14:01 2008
@@ -10,3 +10,13 @@
    %e = add i8 %d, 1
    ret i8 %e
 }
+
+define i32 @f3(i32 %p) {
+   %c = invoke {i32, i8} @foo(i32 %p)
+         to label %L unwind label %L2
+   L: 
+   %d = getresult {i32, i8} %c, 0
+   ret i32 %d
+   L2:
+   ret i32 0
+}





More information about the llvm-commits mailing list