re-commit r109220, the compile error has already been fixed
authorGabor Greif <ggreif@gmail.com>
Mon, 26 Jul 2010 18:48:07 +0000 (18:48 +0000)
committerGabor Greif <ggreif@gmail.com>
Mon, 26 Jul 2010 18:48:07 +0000 (18:48 +0000)
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.

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

docs/ReleaseNotes.html
include/llvm/Use.h

index 61aca32610a0bd261a47a5b9acc27f1c3898c119..01a39a7ce071a9c3d7338167de7b85eec5fe92d4 100644 (file)
@@ -318,6 +318,11 @@ expose new optimization opportunities:</p>
   To be portable across releases, resort to <tt>CallSite</tt> and the
   high-level accessors, such as <tt>getCalledValue</tt> and <tt>setUnwindDest</tt>.
 </li>
+<li>
+  You can no longer pass use_iterators directly to cast<> (and similar), because
+  these routines tend to perform costly dereference operations more than once. You
+  have to dereference the iterators yourself and pass them in.
+</li>
 
 </ul>
 
index 2759338f42aabb2a68d468f383e9766f240cc39f..e1ebc6a51be5d62eaa72422e79667d7ffdcee7a6 100644 (file)
@@ -210,30 +210,6 @@ public:
   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