aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commit3b3b54d35e1e9f0089c7efdca231a04c77e7d061 (patch)
treea71690e730c67fedfe8871410564ff13690454ea /lib
parentc94270c382320cb3fe9c4dc7bf31d56c94e9643d (diff)
downloadexternal_llvm-3b3b54d35e1e9f0089c7efdca231a04c77e7d061.zip
external_llvm-3b3b54d35e1e9f0089c7efdca231a04c77e7d061.tar.gz
external_llvm-3b3b54d35e1e9f0089c7efdca231a04c77e7d061.tar.bz2
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')
-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 0883cc3..da53800 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