Lines Matching refs:Clusters
2380 void SelectionDAGBuilder::sortAndRangeify(CaseClusterVector &Clusters) { in sortAndRangeify() argument
2382 for (const CaseCluster &CC : Clusters) in sortAndRangeify()
2386 std::sort(Clusters.begin(), Clusters.end(), in sortAndRangeify()
2392 const unsigned N = Clusters.size(); in sortAndRangeify()
2395 CaseCluster &CC = Clusters[SrcIndex]; in sortAndRangeify()
2399 if (DstIndex != 0 && Clusters[DstIndex - 1].MBB == Succ && in sortAndRangeify()
2400 (CaseVal->getValue() - Clusters[DstIndex - 1].High->getValue()) == 1) { in sortAndRangeify()
2403 Clusters[DstIndex - 1].High = CaseVal; in sortAndRangeify()
2404 Clusters[DstIndex - 1].Prob += CC.Prob; in sortAndRangeify()
2406 std::memmove(&Clusters[DstIndex++], &Clusters[SrcIndex], in sortAndRangeify()
2407 sizeof(Clusters[SrcIndex])); in sortAndRangeify()
2410 Clusters.resize(DstIndex); in sortAndRangeify()
8205 bool SelectionDAGBuilder::isDense(const CaseClusterVector &Clusters, in isDense() argument
8212 APInt LowCase = Clusters[First].Low->getValue(); in isDense()
8213 APInt HighCase = Clusters[Last].High->getValue(); in isDense()
8242 bool SelectionDAGBuilder::buildJumpTable(CaseClusterVector &Clusters, in buildJumpTable() argument
8256 JTProbs[Clusters[I].MBB] = BranchProbability::getZero(); in buildJumpTable()
8259 assert(Clusters[I].Kind == CC_Range); in buildJumpTable()
8260 Prob += Clusters[I].Prob; in buildJumpTable()
8261 APInt Low = Clusters[I].Low->getValue(); in buildJumpTable()
8262 APInt High = Clusters[I].High->getValue(); in buildJumpTable()
8266 APInt PreviousHigh = Clusters[I - 1].High->getValue(); in buildJumpTable()
8274 Table.push_back(Clusters[I].MBB); in buildJumpTable()
8275 JTProbs[Clusters[I].MBB] += Clusters[I].Prob; in buildJumpTable()
8280 Clusters[First].Low->getValue(), in buildJumpTable()
8281 Clusters[Last].High->getValue())) { in buildJumpTable()
8308 JumpTableHeader JTH(Clusters[First].Low->getValue(), in buildJumpTable()
8309 Clusters[Last].High->getValue(), SI->getCondition(), in buildJumpTable()
8313 JTCluster = CaseCluster::jumpTable(Clusters[First].Low, Clusters[Last].High, in buildJumpTable()
8318 void SelectionDAGBuilder::findJumpTables(CaseClusterVector &Clusters, in findJumpTables() argument
8323 assert(!Clusters.empty()); in findJumpTables()
8324 for (CaseCluster &C : Clusters) in findJumpTables()
8326 for (unsigned i = 1, e = Clusters.size(); i < e; ++i) in findJumpTables()
8327 assert(Clusters[i - 1].High->getValue().slt(Clusters[i].Low->getValue())); in findJumpTables()
8334 const int64_t N = Clusters.size(); in findJumpTables()
8341 APInt Hi = Clusters[i].High->getValue(); in findJumpTables()
8342 APInt Lo = Clusters[i].Low->getValue(); in findJumpTables()
8352 && isDense(Clusters, &TotalCases[0], 0, N - 1, MinDensity)) { in findJumpTables()
8355 if (buildJumpTable(Clusters, 0, N - 1, SI, DefaultMBB, JTCluster)) { in findJumpTables()
8356 Clusters[0] = JTCluster; in findJumpTables()
8357 Clusters.resize(1); in findJumpTables()
8397 if (isDense(Clusters, &TotalCases[0], i, j, MinDensity)) { in findJumpTables()
8424 buildJumpTable(Clusters, First, Last, SI, DefaultMBB, JTCluster)) { in findJumpTables()
8425 Clusters[DstIndex++] = JTCluster; in findJumpTables()
8428 std::memmove(&Clusters[DstIndex++], &Clusters[I], sizeof(Clusters[I])); in findJumpTables()
8431 Clusters.resize(DstIndex); in findJumpTables()
8464 bool SelectionDAGBuilder::buildBitTests(CaseClusterVector &Clusters, in buildBitTests() argument
8475 assert(Clusters[I].Kind == CC_Range); in buildBitTests()
8476 Dests.set(Clusters[I].MBB->getNumber()); in buildBitTests()
8477 NumCmps += (Clusters[I].Low == Clusters[I].High) ? 1 : 2; in buildBitTests()
8481 APInt Low = Clusters[First].Low->getValue(); in buildBitTests()
8482 APInt High = Clusters[Last].High->getValue(); in buildBitTests()
8500 if (Clusters[I].Low->getValue() != Clusters[I - 1].High->getValue() + 1) { in buildBitTests()
8523 if (CBV[j].BB == Clusters[i].MBB) in buildBitTests()
8527 CaseBits(0, Clusters[i].MBB, 0, BranchProbability::getZero())); in buildBitTests()
8531 uint64_t Lo = (Clusters[i].Low->getValue() - LowBound).getZExtValue(); in buildBitTests()
8532 uint64_t Hi = (Clusters[i].High->getValue() - LowBound).getZExtValue(); in buildBitTests()
8536 CB->ExtraProb += Clusters[i].Prob; in buildBitTests()
8537 TotalProb += Clusters[i].Prob; in buildBitTests()
8558 BTCluster = CaseCluster::bitTests(Clusters[First].Low, Clusters[Last].High, in buildBitTests()
8563 void SelectionDAGBuilder::findBitTestClusters(CaseClusterVector &Clusters, in findBitTestClusters() argument
8570 assert(!Clusters.empty()); in findBitTestClusters()
8571 assert(Clusters[0].Kind == CC_Range || Clusters[0].Kind == CC_JumpTable); in findBitTestClusters()
8572 for (const CaseCluster &C : Clusters) in findBitTestClusters()
8574 for (unsigned i = 1; i < Clusters.size(); ++i) in findBitTestClusters()
8575 assert(Clusters[i-1].High->getValue().slt(Clusters[i].Low->getValue())); in findBitTestClusters()
8589 const int64_t N = Clusters.size(); in findBitTestClusters()
8615 if (!rangeFitsInWord(Clusters[i].Low->getValue(), in findBitTestClusters()
8616 Clusters[j].High->getValue())) in findBitTestClusters()
8624 if (Clusters[k].Kind != CC_Range) { in findBitTestClusters()
8628 Dests.set(Clusters[k].MBB->getNumber()); in findBitTestClusters()
8651 if (buildBitTests(Clusters, First, Last, SI, BitTestCluster)) { in findBitTestClusters()
8652 Clusters[DstIndex++] = BitTestCluster; in findBitTestClusters()
8655 std::memmove(&Clusters[DstIndex], &Clusters[First], in findBitTestClusters()
8656 sizeof(Clusters[0]) * NumClusters); in findBitTestClusters()
8660 Clusters.resize(DstIndex); in findBitTestClusters()
9024 CaseClusterVector Clusters; in visitSwitch() local
9025 Clusters.reserve(SI.getNumCases()); in visitSwitch()
9032 Clusters.push_back(CaseCluster::range(CaseVal, CaseVal, Succ, Prob)); in visitSwitch()
9040 sortAndRangeify(Clusters); in visitSwitch()
9047 if (UnreachableDefault && !Clusters.empty()) { in visitSwitch()
9065 New.reserve(Clusters.size()); in visitSwitch()
9066 for (CaseCluster &CC : Clusters) { in visitSwitch()
9070 Clusters = std::move(New); in visitSwitch()
9076 if (Clusters.empty()) { in visitSwitch()
9085 findJumpTables(Clusters, &SI, DefaultMBB); in visitSwitch()
9086 findBitTestClusters(Clusters, &SI); in visitSwitch()
9090 for (const CaseCluster &C : Clusters) { in visitSwitch()
9104 assert(!Clusters.empty()); in visitSwitch()
9106 CaseClusterIt First = Clusters.begin(); in visitSwitch()
9107 CaseClusterIt Last = Clusters.end() - 1; in visitSwitch()