summaryrefslogtreecommitdiff
path: root/lib/VMCore/Type.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-09-27 07:55:32 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-09-27 07:55:32 +0000
commit513869453be688d772df7364c141a981f50c6d56 (patch)
treea71690e730c67fedfe8871410564ff13690454ea /lib/VMCore/Type.cpp
parent6776064d190701c5bae4d5403939eed2e480d1cd (diff)
downloadllvm-513869453be688d772df7364c141a981f50c6d56.tar.gz
llvm-513869453be688d772df7364c141a981f50c6d56.tar.bz2
llvm-513869453be688d772df7364c141a981f50c6d56.tar.xz
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
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r--lib/VMCore/Type.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 0883cc304b..da53800ad7 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<PointerType>(RetTy))
- return PTy->getElementType()->getTypeID() != MetadataTyID;
- return true;
- }
- if (RetTy->getTypeID() == VoidTyID || RetTy->getTypeID() == MetadataTyID ||
- isa<OpaqueType>(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<StructType>(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<PointerType>(RetTy))
+ return PTy->getElementType()->getTypeID() != MetadataTyID;
+
+ return RetTy->getTypeID() != LabelTyID &&
+ RetTy->getTypeID() != MetadataTyID;
}
/// isValidArgumentType - Return true if the specified type is valid as an