Inline the fastpath of PATypeHolder::get(). This is a small speedup in
authorChris Lattner <sabre@nondot.org>
Fri, 15 Aug 2008 15:16:50 +0000 (15:16 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 15 Aug 2008 15:16:50 +0000 (15:16 +0000)
instcombine among other things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54814 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Type.h
lib/VMCore/Type.cpp

index fe3c392c7c6cd03f597aca9ead7c76c7800fcc7f..5bcb654a4a907d8e293965fb578a91192dbb9373 100644 (file)
@@ -392,6 +392,17 @@ inline void PATypeHandle::removeUser() {
 
 // Define inline methods for PATypeHolder.
 
+/// get - This implements the forwarding part of the union-find algorithm for
+/// abstract types.  Before every access to the Type*, we check to see if the
+/// type we are pointing to is forwarding to a new type.  If so, we drop our
+/// reference to the type.
+///
+inline Type* PATypeHolder::get() const {
+  const Type *NewTy = Ty->getForwardedType();
+  if (!NewTy) return const_cast<Type*>(Ty);
+  return *const_cast<PATypeHolder*>(this) = NewTy;
+}
+
 inline void PATypeHolder::addRef() {
   assert(Ty && "Type Holder has a null type!");
   if (Ty->isAbstract())
index b7bf339ab8d1a137d225d631a7d2b27b726636b9..be211949799ebfd0b6b342344bb9a6e0a7cef93e 100644 (file)
@@ -34,21 +34,6 @@ using namespace llvm;
 AbstractTypeUser::~AbstractTypeUser() {}
 
 
-//===----------------------------------------------------------------------===//
-//                         Type PATypeHolder Implementation
-//===----------------------------------------------------------------------===//
-
-/// get - This implements the forwarding part of the union-find algorithm for
-/// abstract types.  Before every access to the Type*, we check to see if the
-/// type we are pointing to is forwarding to a new type.  If so, we drop our
-/// reference to the type.
-///
-Type* PATypeHolder::get() const {
-  const Type *NewTy = Ty->getForwardedType();
-  if (!NewTy) return const_cast<Type*>(Ty);
-  return *const_cast<PATypeHolder*>(this) = NewTy;
-}
-
 //===----------------------------------------------------------------------===//
 //                         Type Class Implementation
 //===----------------------------------------------------------------------===//