mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-30 04:35:00 +00:00
if we have two elements, insert both, don't use std::sort.
This speeds up the new GVN by another 3% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1aeadacdad
commit
ba4dacc875
@ -621,16 +621,29 @@ getNonLocalPointerDepInternal(Value *Pointer, uint64_t PointeeSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we computed new values, re-sort Cache.
|
// If we computed new values, re-sort Cache.
|
||||||
if (NumSortedEntries == Cache->size()) {
|
switch (Cache->size()-NumSortedEntries) {
|
||||||
|
case 0:
|
||||||
// done, no new entries.
|
// 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.
|
// One new entry, Just insert the new value at the appropriate position.
|
||||||
NonLocalDepEntry Val = Cache->back();
|
NonLocalDepEntry Val = Cache->back();
|
||||||
Cache->pop_back();
|
Cache->pop_back();
|
||||||
NonLocalDepInfo::iterator Entry =
|
NonLocalDepInfo::iterator Entry =
|
||||||
std::upper_bound(Cache->begin(), Cache->end(), Val);
|
std::upper_bound(Cache->begin(), Cache->end(), Val);
|
||||||
Cache->insert(Entry, Val);
|
Cache->insert(Entry, Val);
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
// Added many values, do a full scale sort.
|
// Added many values, do a full scale sort.
|
||||||
std::sort(Cache->begin(), Cache->end());
|
std::sort(Cache->begin(), Cache->end());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user