[llvm-commits] [llvm] r132999 - /llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Jun 14 09:58:16 PDT 2011
Author: stoklund
Date: Tue Jun 14 11:58:16 2011
New Revision: 132999
URL: http://llvm.org/viewvc/llvm-project?rev=132999&view=rev
Log:
Fix a compile time regression caused by too small hash tables.
Measure the worst case number of probes for a miss instead of the less
conservative number of probes required for an insertion.
Lower the limit to < 6 probes worst case.
This doubles the size of the ARM and X86 hash tables, other targets are
unaffected. LiveVariables runs 12% faster with this change.
<rdar://problem/9598545>
Modified:
llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=132999&r1=132998&r2=132999&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Tue Jun 14 11:58:16 2011
@@ -145,7 +145,6 @@
HT.assign(HSize, Sentinel);
// Insert all entries.
- MaxProbes = 0;
for (unsigned i = 0, e = Data.size(); i != e; ++i) {
UUPair D = Data[i];
unsigned Idx = (D.first * 11 + D.second * 97) & (HSize - 1);
@@ -155,10 +154,24 @@
ProbeAmt += 1;
}
HT[Idx] = D;
+ }
+
+ // Now measure the max number of probes for any worst case miss.
+ MaxProbes = 0;
+ unsigned TotalProbes = 0;
+ for (unsigned i = 0, e = HSize; i != e; ++i) {
+ unsigned Idx = i;
+ unsigned ProbeAmt = 1;
+ while (HT[Idx] != Sentinel) {
+ Idx = (Idx + ProbeAmt) & (HSize - 1);
+ ProbeAmt += 1;
+ }
+ TotalProbes += ProbeAmt;
MaxProbes = std::max(MaxProbes, ProbeAmt);
}
- OS << "\n // Max number of probes: " << MaxProbes;
- } while (MaxProbes >= 8);
+ OS << "\n // Max number of probes: " << MaxProbes
+ << format(", avg %.1f", float(TotalProbes)/HSize);
+ } while (MaxProbes >= 6);
// Print the hash table.
OS << "\n // Used entries: " << Data.size()
More information about the llvm-commits
mailing list