From 05006e2813e3219a508d5261f3782ef47c08f762 Mon Sep 17 00:00:00 2001
From: Gabor Greif
Date: Mon, 26 Jul 2010 18:48:07 +0000
Subject: [PATCH] re-commit r109220, the compile error has already been fixed
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 | 5 +++++
include/llvm/Use.h | 24 ------------------------
2 files changed, 5 insertions(+), 24 deletions(-)
diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html
index 61aca32610a..01a39a7ce07 100644
--- a/docs/ReleaseNotes.html
+++ b/docs/ReleaseNotes.html
@@ -318,6 +318,11 @@ expose new optimization opportunities:
To be portable across releases, resort to CallSite and the
high-level accessors, such as getCalledValue and setUnwindDest.
+
+ 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.
+
diff --git a/include/llvm/Use.h b/include/llvm/Use.h
index 2759338f42a..e1ebc6a51be 100644
--- a/include/llvm/Use.h
+++ b/include/llvm/Use.h
@@ -210,30 +210,6 @@ public:
unsigned getOperandNo() const;
};
-
-template<> struct simplify_type > {
- typedef User* SimpleType;
-
- static SimpleType getSimplifiedValue(const value_use_iterator &Val) {
- return *Val;
- }
-};
-
-template<> struct simplify_type >
- : public simplify_type > {};
-
-template<> struct simplify_type > {
- typedef const User* SimpleType;
-
- static SimpleType getSimplifiedValue(const
- value_use_iterator &Val) {
- return *Val;
- }
-};
-
-template<> struct simplify_type >
- : public simplify_type > {};
-
} // End llvm namespace
#endif
--
2.34.1