Home | History | Annotate | Download | only in Utils

Lines Matching refs:Weights

617     // Collect branch weights into a vector.
618 SmallVector<uint32_t, 8> Weights;
626 Weights.push_back(CI->getValue().getZExtValue());
632 std::swap(Weights[i.getCaseIndex()+1], Weights.back());
633 Weights.pop_back();
639 if (HasWeight && Weights.size() >= 2)
642 createBranchWeights(Weights));
721 /// Get Weights of a given TerminatorInst, the default weight is at the front
725 SmallVectorImpl<uint64_t> &Weights) {
731 Weights.push_back(CI->getValue().getZExtValue());
738 assert(Weights.size() == 2);
741 std::swap(Weights.front(), Weights.back());
745 /// Sees if any of the weights are too big for a uint32_t, and halves all the
746 /// weights if any are.
747 static void FitWeights(MutableArrayRef<uint64_t> Weights) {
749 for (unsigned i = 0; i < Weights.size(); ++i)
750 if (Weights[i] > UINT_MAX) {
758 for (unsigned i = 0; i < Weights.size(); ++i)
759 Weights[i] /= 2;
795 SmallVector<uint64_t, 8> Weights;
800 GetBranchWeights(PTI, Weights);
802 if (Weights.size() != 1 + PredCases.size())
805 // If there are no predecessor weights but there are successor weights,
806 // populate Weights with 1, which will later be scaled to the sum of
807 // successor's weights
808 Weights.assign(1 + PredCases.size(), 1);
832 Weights[0] += Weights[i+1];
833 std::swap(Weights[i+1], Weights.back());
834 Weights.pop_back();
848 unsigned CasesFromPred = Weights.size();
858 // PredDefaultWeight (Weights[0]).
859 Weights.push_back(Weights[0] * SuccWeights[i+1]);
868 Weights[i] *= ValidTotalSuccWeight;
870 Weights[0] *= SuccWeights[0];
883 WeightsForHandled[PredCases[i].Value] = Weights[i+1];
884 std::swap(Weights[i+1], Weights.back());
885 Weights.pop_back();
899 Weights.push_back(WeightsForHandled[BBCases[i].Value]);
911 Weights.push_back(WeightsForHandled[*I]);
939 // Halve the weights if any of them cannot fit in an uint32_t
940 FitWeights(Weights);
942 SmallVector<uint32_t, 8> MDWeights(Weights.begin(), Weights.end());
2164 // We assume that total weights of a BranchInst can fit into 32 bits.
2187 // Halve the weights if any of them cannot fit in an uint32_t
2422 // Halve the weights if any of them cannot fit in an uint32_t
2545 SmallVector<uint64_t, 8> Weights;
2548 GetBranchWeights(SI, Weights);
2549 if (Weights.size() == 1 + SI->getNumCases()) {
2550 TrueWeight = (uint32_t)Weights[SI->findCaseValue(TrueVal).
2552 FalseWeight = (uint32_t)Weights[SI->findCaseValue(FalseVal).
2679 SmallVector<uint64_t, 8> Weights;
2682 GetBranchWeights(SI, Weights);
2683 if (Weights.size() == 1 + SI->getNumCases()) {
2685 Weights[0] = (Weights[0]+1) >> 1;
2686 Weights.push_back(Weights[0]);
2688 SmallVector<uint32_t, 8> MDWeights(Weights.begin(), Weights.end());
3130 SmallVector<uint64_t, 8> Weights;
3133 GetBranchWeights(SI, Weights);
3134 if (Weights.size() == 1 + SI->getNumCases()) {
3135 // Combine all weights for the cases to be the true weight of NewBI.
3136 // We assume that the sum of all weights for a Terminator can fit into 32
3139 for (unsigned I = 1, E = Weights.size(); I != E; ++I)
3140 NewTrueWeight += (uint32_t)Weights[I];
3144 (uint32_t)Weights[0]));
3178 SmallVector<uint64_t, 8> Weights;
3181 GetBranchWeights(SI, Weights);
3182 HasWeight = (Weights.size() == 1 + SI->getNumCases());
3191 std::swap(Weights[Case.getCaseIndex()+1], Weights.back());
3192 Weights.pop_back();
3200 SmallVector<uint32_t, 8> MDWeights(Weights.begin(), Weights.end());