[llvm-commits] [llvm] r128810 - in /llvm/trunk: lib/Target/CBackend/CBackend.cpp lib/Transforms/IPO/IPConstantPropagation.cpp lib/VMCore/Verifier.cpp test/Assembler/aggregate-return-single-value.ll

Jay Foad jay.foad at gmail.com
Mon Apr 4 00:44:02 PDT 2011


Author: foad
Date: Mon Apr  4 02:44:02 2011
New Revision: 128810

URL: http://llvm.org/viewvc/llvm-project?rev=128810&view=rev
Log:
Remove some support for ReturnInsts with multiple operands, and for
returning a scalar value in a function whose return type is a single-
element structure or array.

Modified:
    llvm/trunk/lib/Target/CBackend/CBackend.cpp
    llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp
    llvm/trunk/lib/VMCore/Verifier.cpp
    llvm/trunk/test/Assembler/aggregate-return-single-value.ll

Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=128810&r1=128809&r2=128810&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Mon Apr  4 02:44:02 2011
@@ -2440,24 +2440,6 @@
     return;
   }
 
-  if (I.getNumOperands() > 1) {
-    Out << "  {\n";
-    Out << "    ";
-    printType(Out, I.getParent()->getParent()->getReturnType());
-    Out << "   llvm_cbe_mrv_temp = {\n";
-    for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
-      Out << "      ";
-      writeOperand(I.getOperand(i));
-      if (i != e - 1)
-        Out << ",";
-      Out << "\n";
-    }
-    Out << "    };\n";
-    Out << "    return llvm_cbe_mrv_temp;\n";
-    Out << "  }\n";
-    return;
-  }
-
   Out << "  return";
   if (I.getNumOperands()) {
     Out << ' ';

Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=128810&r1=128809&r2=128810&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Mon Apr  4 02:44:02 2011
@@ -186,7 +186,7 @@
         // Find the returned value
         Value *V;
         if (!STy)
-          V = RI->getOperand(i);
+          V = RI->getOperand(0);
         else
           V = FindInsertedValue(RI->getOperand(0), i);
 

Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=128810&r1=128809&r2=128810&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Mon Apr  4 02:44:02 2011
@@ -826,30 +826,10 @@
     Assert2(N == 0,
             "Found return instr that returns non-void in Function of void "
             "return type!", &RI, F->getReturnType());
-  else if (N == 1 && F->getReturnType() == RI.getOperand(0)->getType()) {
-    // Exactly one return value and it matches the return type. Good.
-  } else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
-    // The return type is a struct; check for multiple return values.
-    Assert2(STy->getNumElements() == N,
-            "Incorrect number of return values in ret instruction!",
-            &RI, F->getReturnType());
-    for (unsigned i = 0; i != N; ++i)
-      Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(),
-              "Function return type does not match operand "
-              "type of return inst!", &RI, F->getReturnType());
-  } else if (const ArrayType *ATy = dyn_cast<ArrayType>(F->getReturnType())) {
-    // The return type is an array; check for multiple return values.
-    Assert2(ATy->getNumElements() == N,
-            "Incorrect number of return values in ret instruction!",
-            &RI, F->getReturnType());
-    for (unsigned i = 0; i != N; ++i)
-      Assert2(ATy->getElementType() == RI.getOperand(i)->getType(),
-              "Function return type does not match operand "
-              "type of return inst!", &RI, F->getReturnType());
-  } else {
-    CheckFailed("Function return type does not match operand "
-                "type of return inst!", &RI, F->getReturnType());
-  }
+  else
+    Assert2(N == 1 && F->getReturnType() == RI.getOperand(0)->getType(),
+            "Function return type does not match operand "
+            "type of return inst!", &RI, F->getReturnType());
 
   // Check to make sure that the return value has necessary properties for
   // terminators...

Modified: llvm/trunk/test/Assembler/aggregate-return-single-value.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/aggregate-return-single-value.ll?rev=128810&r1=128809&r2=128810&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/aggregate-return-single-value.ll (original)
+++ llvm/trunk/test/Assembler/aggregate-return-single-value.ll Mon Apr  4 02:44:02 2011
@@ -1,14 +1,8 @@
 ; RUN: llvm-as < %s | llvm-dis
 
-define { i32 } @fooa() nounwind {
-  ret i32 0
-}
 define { i32 } @foob() nounwind {
   ret {i32}{ i32 0 }
 }
-define [1 x i32] @fooc() nounwind {
-  ret i32 0
-}
 define [1 x i32] @food() nounwind {
   ret [1 x i32][ i32 0 ]
 }





More information about the llvm-commits mailing list