[llvm-commits] [llvm] r109220 - /llvm/trunk/include/llvm/Use.h

Gabor Greif ggreif at gmail.com
Fri Jul 23 01:36:07 PDT 2010


Author: ggreif
Date: Fri Jul 23 03:36:07 2010
New Revision: 109220

URL: http://llvm.org/viewvc/llvm-project?rev=109220&view=rev
Log:
Simplifying use_iterators by dereferencing
is not a good idea. The codebase does not depend
in this any more, and it may introduce hidden
runtime cost. If you get compile errors, please
dereference your iterator before passing to cast<>
(and friends).

Also: please consider caching the result of
operator* and reusing that instead of dereferencing
many times.

Modified:
    llvm/trunk/include/llvm/Use.h

Modified: llvm/trunk/include/llvm/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=109220&r1=109219&r2=109220&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Use.h (original)
+++ llvm/trunk/include/llvm/Use.h Fri Jul 23 03:36:07 2010
@@ -210,30 +210,6 @@
   unsigned getOperandNo() const;
 };
 
-
-template<> struct simplify_type<value_use_iterator<User> > {
-  typedef User* SimpleType;
-  
-  static SimpleType getSimplifiedValue(const value_use_iterator<User> &Val) {
-    return *Val;
-  }
-};
-
-template<> struct simplify_type<const value_use_iterator<User> >
- : public simplify_type<value_use_iterator<User> > {};
-
-template<> struct simplify_type<value_use_iterator<const User> > {
-  typedef const User* SimpleType;
-  
-  static SimpleType getSimplifiedValue(const 
-                                       value_use_iterator<const User> &Val) {
-    return *Val;
-  }
-};
-
-template<> struct simplify_type<const value_use_iterator<const User> >
-  : public simplify_type<value_use_iterator<const User> > {};
- 
 } // End llvm namespace
 
 #endif





More information about the llvm-commits mailing list