[llvm-commits] [llvm] r54814 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/Type.cpp

Chris Lattner sabre at nondot.org
Fri Aug 15 08:16:51 PDT 2008


Author: lattner
Date: Fri Aug 15 10:16:50 2008
New Revision: 54814

URL: http://llvm.org/viewvc/llvm-project?rev=54814&view=rev
Log:
Inline the fastpath of PATypeHolder::get().  This is a small speedup in 
instcombine among other things.

Modified:
    llvm/trunk/include/llvm/Type.h
    llvm/trunk/lib/VMCore/Type.cpp

Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=54814&r1=54813&r2=54814&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Fri Aug 15 10:16:50 2008
@@ -392,6 +392,17 @@
 
 // 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())

Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=54814&r1=54813&r2=54814&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Fri Aug 15 10:16:50 2008
@@ -35,21 +35,6 @@
 
 
 //===----------------------------------------------------------------------===//
-//                         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
 //===----------------------------------------------------------------------===//
 





More information about the llvm-commits mailing list