Home | History | Annotate | Download | only in Utils

Lines Matching defs:Weights

629     // Collect branch weights into a vector.
630 SmallVector<uint32_t, 8> Weights;
638 Weights.push_back(CI->getValue().getZExtValue());
644 std::swap(Weights[i.getCaseIndex()+1], Weights.back());
645 Weights.pop_back();
651 if (HasWeight && Weights.size() >= 2)
654 createBranchWeights(Weights));
734 /// Get Weights of a given TerminatorInst, the default weight is at the front
738 SmallVectorImpl<uint64_t> &Weights) {
743 Weights.push_back(CI->getValue().getZExtValue());
750 assert(Weights.size() == 2);
753 std::swap(Weights.front(), Weights.back());
757 /// Keep halving the weights until all can fit in uint32_t.
758 static void FitWeights(MutableArrayRef<uint64_t> Weights) {
759 uint64_t Max = *std::max_element(Weights.begin(), Weights.end());
762 for (uint64_t &I : Weights)
800 SmallVector<uint64_t, 8> Weights;
805 GetBranchWeights(PTI, Weights);
807 if (Weights.size() != 1 + PredCases.size())
810 // If there are no predecessor weights but there are successor weights,
811 // populate Weights with 1, which will later be scaled to the sum of
812 // successor's weights
813 Weights.assign(1 + PredCases.size(), 1);
837 Weights[0] += Weights[i+1];
838 std::swap(Weights[i+1], Weights.back());
839 Weights.pop_back();
853 unsigned CasesFromPred = Weights.size();
863 // PredDefaultWeight (Weights[0]).
864 Weights.push_back(Weights[0] * SuccWeights[i+1]);
873 Weights[i] *= ValidTotalSuccWeight;
875 Weights[0] *= SuccWeights[0];
888 WeightsForHandled[PredCases[i].Value] = Weights[i+1];
889 std::swap(Weights[i+1], Weights.back());
890 Weights.pop_back();
904 Weights.push_back(WeightsForHandled[BBCases[i].Value]);
916 Weights.push_back(WeightsForHandled[*I]);
944 // Halve the weights if any of them cannot fit in an uint32_t
945 FitWeights(Weights);
947 SmallVector<uint32_t, 8> MDWeights(Weights.begin(), Weights.end());
2197 // We assume that total weights of a BranchInst can fit into 32 bits.
2220 // Halve the weights if any of them cannot fit in an uint32_t
2472 // Halve the weights if any of them cannot fit in an uint32_t
2595 SmallVector<uint64_t, 8> Weights;
2598 GetBranchWeights(SI, Weights);
2599 if (Weights.size() == 1 + SI->getNumCases()) {
2600 TrueWeight = (uint32_t)Weights[SI->findCaseValue(TrueVal).
2602 FalseWeight = (uint32_t)Weights[SI->findCaseValue(FalseVal).
2729 SmallVector<uint64_t, 8> Weights;
2732 GetBranchWeights(SI, Weights);
2733 if (Weights.size() == 1 + SI->getNumCases()) {
2735 Weights[0] = (Weights[0]+1) >> 1;
2736 Weights.push_back(Weights[0]);
2738 SmallVector<uint32_t, 8> MDWeights(Weights.begin(), Weights.end());
3180 SmallVector<uint64_t, 8> Weights;
3183 GetBranchWeights(SI, Weights);
3184 if (Weights.size() == 1 + SI->getNumCases()) {
3185 // Combine all weights for the cases to be the true weight of NewBI.
3186 // We assume that the sum of all weights for a Terminator can fit into 32
3189 for (unsigned I = 1, E = Weights.size(); I != E; ++I)
3190 NewTrueWeight += (uint32_t)Weights[I];
3194 (uint32_t)Weights[0]));
3228 SmallVector<uint64_t, 8> Weights;
3231 GetBranchWeights(SI, Weights);
3232 HasWeight = (Weights.size() == 1 + SI->getNumCases());
3241 std::swap(Weights[Case.getCaseIndex()+1], Weights.back());
3242 Weights.pop_back();
3249 if (HasWeight && Weights.size() >= 2) {
3250 SmallVector<uint32_t, 8> MDWeights(Weights.begin(), Weights.end());