From 513869453be688d772df7364c141a981f50c6d56 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Sun, 27 Sep 2009 07:55:32 +0000 Subject: [PATCH] Remove dead code from this function and optimize. Update its corresponding LangRef entry too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82890 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 10 +++++----- lib/VMCore/Type.cpp | 24 +++++------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index 935625dbfaa..6f5fbb3f35b 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1592,7 +1592,7 @@ Classifications
Syntax:
-  <returntype list> (<parameter list>)
+  <returntype> (<parameter list>)
 

...where '<parameter list>' is a comma-separated list of type @@ -1600,8 +1600,8 @@ Classifications which indicates that the function takes a variable number of arguments. Variable argument functions can access their arguments with the variable argument handling intrinsic - functions. '<returntype list>' is a comma-separated list of - first class type specifiers.

+ functions. '<returntype>' is a any type except + label and metadata.

Examples:
@@ -1626,8 +1626,8 @@ Classifications -
{i32, i32} (i32)A function taking an i32, returning two - i32 values as an aggregate of type { i32, i32 } + A function taking an i32, returning a + structure containing two i32 values
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 0883cc304b1..da53800ad7e 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -365,25 +365,11 @@ const IntegerType *Type::getInt64Ty(LLVMContext &C) { /// isValidReturnType - Return true if the specified type is valid as a return /// type. bool FunctionType::isValidReturnType(const Type *RetTy) { - if (RetTy->isFirstClassType()) { - if (const PointerType *PTy = dyn_cast(RetTy)) - return PTy->getElementType()->getTypeID() != MetadataTyID; - return true; - } - if (RetTy->getTypeID() == VoidTyID || RetTy->getTypeID() == MetadataTyID || - isa(RetTy)) - return true; - - // If this is a multiple return case, verify that each return is a first class - // value and that there is at least one value. - const StructType *SRetTy = dyn_cast(RetTy); - if (SRetTy == 0 || SRetTy->getNumElements() == 0) - return false; - - for (unsigned i = 0, e = SRetTy->getNumElements(); i != e; ++i) - if (!SRetTy->getElementType(i)->isFirstClassType()) - return false; - return true; + if (const PointerType *PTy = dyn_cast(RetTy)) + return PTy->getElementType()->getTypeID() != MetadataTyID; + + return RetTy->getTypeID() != LabelTyID && + RetTy->getTypeID() != MetadataTyID; } /// isValidArgumentType - Return true if the specified type is valid as an