mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Switch lowering: order bit tests by branch weight.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235912 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -7482,12 +7482,15 @@ bool SelectionDAGBuilder::buildBitTests(CaseClusterVector &Clusters,
|
||||
CB->Bits++;
|
||||
}
|
||||
CB->ExtraWeight += Clusters[i].Weight;
|
||||
assert(CB->ExtraWeight >= Clusters[i].Weight && "Weight sum overflowed!");
|
||||
TotalWeight += Clusters[i].Weight;
|
||||
}
|
||||
|
||||
BitTestInfo BTI;
|
||||
std::sort(CBV.begin(), CBV.end(), [](const CaseBits &a, const CaseBits &b) {
|
||||
// FIXME: Sort by weight.
|
||||
// Sort by weight first, number of bits second.
|
||||
if (a.ExtraWeight != b.ExtraWeight)
|
||||
return a.ExtraWeight > b.ExtraWeight;
|
||||
return a.Bits > b.Bits;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user