[llvm-commits] [llvm] r54053 - /llvm/trunk/include/llvm/Support/IRBuilder.h

Dan Gohman gohman at apple.com
Fri Jul 25 13:36:15 PDT 2008


Author: djg
Date: Fri Jul 25 15:36:15 2008
New Revision: 54053

URL: http://llvm.org/viewvc/llvm-project?rev=54053&view=rev
Log:
Rename the version of CreateRet that's a convenience method for creating
multiple-valued return values, so that the name CreateRet is just for
creating plain ret statements.

Modified:
    llvm/trunk/include/llvm/Support/IRBuilder.h

Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=54053&r1=54052&r2=54053&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Fri Jul 25 15:36:15 2008
@@ -101,12 +101,15 @@
     return Insert(ReturnInst::Create(V));
   }
 
-  ReturnInst *CreateRet(Value * const* retVals, unsigned N) {
+  /// CreateAggregateRet - Create a sequence of N insertvalue instructions,
+  /// with one Value from the retVals array each, that build a aggregate
+  /// return value one value at a time, and a ret instruction to return
+  /// the resulting aggregate value. This is a convenience function for
+  /// code that uses aggregate return values as a vehicle for having
+  /// multiple return values.
+  ///
+  ReturnInst *CreateAggregateRet(Value * const* retVals, unsigned N) {
     const Type *RetType = BB->getParent()->getReturnType();
-    if (N == 0 && RetType == Type::VoidTy)
-      return CreateRetVoid();
-    if (N == 1 && retVals[0]->getType() == RetType)
-      return Insert(ReturnInst::Create(retVals[0]));
     Value *V = UndefValue::get(RetType);
     for (unsigned i = 0; i != N; ++i)
       V = CreateInsertValue(V, retVals[i], i, "mrv");





More information about the llvm-commits mailing list