[llvm-commits] [llvm] r60747 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Chris Lattner
sabre at nondot.org
Mon Dec 8 23:05:45 PST 2008
Author: lattner
Date: Tue Dec 9 01:05:45 2008
New Revision: 60747
URL: http://llvm.org/viewvc/llvm-project?rev=60747&view=rev
Log:
if we have two elements, insert both, don't use std::sort.
This speeds up the new GVN by another 3%
Modified:
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=60747&r1=60746&r2=60747&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Tue Dec 9 01:05:45 2008
@@ -621,16 +621,29 @@
}
// If we computed new values, re-sort Cache.
- if (NumSortedEntries == Cache->size()) {
+ switch (Cache->size()-NumSortedEntries) {
+ case 0:
// done, no new entries.
- } else if (NumSortedEntries+1 == Cache->size()) {
+ break;
+ case 2: {
+ // Two new entries, insert the last one into place.
+ NonLocalDepEntry Val = Cache->back();
+ Cache->pop_back();
+ NonLocalDepInfo::iterator Entry =
+ std::upper_bound(Cache->begin(), Cache->end()-1, Val);
+ Cache->insert(Entry, Val);
+ // FALL THROUGH.
+ }
+ case 1: {
// One new entry, Just insert the new value at the appropriate position.
NonLocalDepEntry Val = Cache->back();
Cache->pop_back();
NonLocalDepInfo::iterator Entry =
std::upper_bound(Cache->begin(), Cache->end(), Val);
Cache->insert(Entry, Val);
- } else {
+ break;
+ }
+ default:
// Added many values, do a full scale sort.
std::sort(Cache->begin(), Cache->end());
}
More information about the llvm-commits
mailing list