Let invoke return aggregate value.
authorDevang Patel <dpatel@apple.com>
Thu, 21 Feb 2008 02:14:01 +0000 (02:14 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 21 Feb 2008 02:14:01 +0000 (02:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47425 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Value.cpp
lib/VMCore/Verifier.cpp
test/Assembler/2008-02-20-MultipleReturnValue.ll

index 440e0a63fdbce50ebef987fedd43d95305097e9f..9f8f56e1a7482d9d6c344fe8dd7612cae725e690 100644 (file)
@@ -34,7 +34,7 @@ static inline const Type *checkType(const Type *Ty) {
 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!");
index 27adc089c381f3d002758f1477c7e0b7edb2ebe0..2eb306b264b7be4c83faab03eee7f842792b5b30 100644 (file)
@@ -1072,7 +1072,8 @@ void Verifier::visitInstruction(Instruction &I) {
   // 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 @@ void Verifier::visitInstruction(Instruction &I) {
       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();
index a40fa3ebcfcd85af8a7a6f7746aeb9faaab781da..f84ceef293bd436fa2c06ec042a8271b3b98ddf1 100644 (file)
@@ -10,3 +10,13 @@ define i8 @f2(i32 %p) {
    %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
+}