diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-02-02 05:31:01 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-02-02 05:31:01 +0000 |
commit | a46c898314736a1ca9082af51ae97323c36fe470 (patch) | |
tree | 8ae5b51c55fcb4fda3920dce422a29b0a5b8bde2 /llvm/lib/Transforms/IPO | |
parent | 4272cc7d4c1e1a8cb39595cfe691e2d6985f7161 (diff) | |
download | bcm5719-llvm-a46c898314736a1ca9082af51ae97323c36fe470.tar.gz bcm5719-llvm-a46c898314736a1ca9082af51ae97323c36fe470.zip |
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.
llvm-svn: 124717
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 2039b740a38..e2dd48458b4 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/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. |