summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-02-02 05:31:01 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-02-02 05:31:01 +0000
commit8eb3e54592ae7d7b43454fcd08d0da7a51ecd4d8 (patch)
tree8f94f248404aea1c593a2b633c8d1d03c520dceb /lib/Transforms/IPO/MergeFunctions.cpp
parent5195b71941b49b3be7915cf4a52c951ac72e0a83 (diff)
downloadllvm-8eb3e54592ae7d7b43454fcd08d0da7a51ecd4d8.tar.gz
llvm-8eb3e54592ae7d7b43454fcd08d0da7a51ecd4d8.tar.bz2
llvm-8eb3e54592ae7d7b43454fcd08d0da7a51ecd4d8.tar.xz
Remove wasteful caching. This isn't needed for correctness because any function
that might have changed been affected by a merge elsewhere will have been removed from the function set, and it isn't needed for performance because we call grow() ahead of time to prevent reallocations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--lib/Transforms/IPO/MergeFunctions.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp
index 2039b740a3..e2dd48458b 100644
--- a/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/lib/Transforms/IPO/MergeFunctions.cpp
@@ -112,23 +112,10 @@ public:
Func = NULL;
}
- bool &getOrInsertCachedComparison(const ComparableFunction &Other,
- bool &inserted) const {
- typedef DenseMap<Function *, bool>::iterator iterator;
- std::pair<iterator, bool> p =
- CompareResultCache.insert(std::make_pair(Other.getFunc(), false));
- inserted = p.second;
- return p.first->second;
- }
-
private:
explicit ComparableFunction(unsigned Hash)
: Func(NULL), Hash(Hash), TD(NULL) {}
- // DenseMap::grow() triggers a recomparison of all keys in the map, which is
- // wildly expensive. This cache tries to preserve known results.
- mutable DenseMap<Function *, bool> CompareResultCache;
-
AssertingVH<Function> Func;
unsigned Hash;
TargetData *TD;
@@ -675,16 +662,8 @@ bool DenseMapInfo<ComparableFunction>::isEqual(const ComparableFunction &LHS,
assert(LHS.getTD() == RHS.getTD() &&
"Comparing functions for different targets");
- bool inserted;
- bool &result1 = LHS.getOrInsertCachedComparison(RHS, inserted);
- if (!inserted)
- return result1;
- bool &result2 = RHS.getOrInsertCachedComparison(LHS, inserted);
- if (!inserted)
- return result1 = result2;
-
- return result1 = result2 = FunctionComparator(LHS.getTD(), LHS.getFunc(),
- RHS.getFunc()).compare();
+ return FunctionComparator(LHS.getTD(), LHS.getFunc(),
+ RHS.getFunc()).compare();
}
// Replace direct callers of Old with New.