Home | History | Annotate | Download | only in Scalar

Lines Matching defs:Weight

15 // This pass generates branch weight annotations on the IR:
19 // The weight of each edge is the weight of the target block for
20 // that edge. The weight of a block B is computed as the maximum
127 /// The weight of a basic block is defined to be the maximum
179 /// \brief Print the weight of edge \p E on stream \p OS.
184 OS << "weight[" << E.first->getName() << "->" << E.second->getName()
199 /// \brief Print the weight of block \p BB on stream \p OS.
204 OS << "weight[" << BB->getName() << "]: " << BlockWeights[BB] << "\n";
207 /// \brief Get the weight for an instruction.
209 /// The "weight" of an instruction \p Inst is the number of samples
217 /// \returns The profiled weight of I.
230 unsigned Weight = Samples->samplesAt(LOffset, Discriminator);
233 << " - weight: " << Weight << ")\n");
234 return Weight;
237 /// \brief Compute the weight of a basic block.
239 /// The weight of basic block \p BB is the maximum weight of all the
240 /// instructions in BB. The weight of \p BB is computed and cached in
245 /// \returns The computed weight of BB.
247 // If we've computed BB's weight before, return it.
253 // Otherwise, compute and cache BB's weight.
254 unsigned Weight = 0;
257 if (InstWeight > Weight)
258 Weight = InstWeight;
260 Entry.first->second = Weight;
261 return Weight;
274 unsigned Weight = getBlockWeight(&BB);
275 Changed |= (Weight > 0);
315 // If BB2 is heavier than BB1, make BB2 have the same weight
321 // make sure that BB1 has the largest weight of all the
334 /// weight. To compute the concept of equivalence, we use dominance and loop
388 // each equivalence class has the largest weight, assign that weight
390 DEBUG(dbgs() << "\nAssign the same weight to all blocks in the same class\n");
400 /// \brief Visit the given edge to decide if it has a valid weight.
409 /// \returns E's weight, if known. Otherwise, return 0.
423 /// If the weight of a basic block is known, and there is only one edge
424 /// with an unknown weight, we can calculate the weight of that edge.
439 // which ones have a weight assigned already. Note that it doesn't
469 // is the same as BB's weight. If not, we change BB's weight
474 // In this case, we can compute the weight of the edge by
475 // subtracting the total block weight from all the known
476 // edge weights. If the edges weight more than BB, then the
479 // - There exists a self-referential edge and the weight of BB is
480 // known. In this case, this edge can be based on BB's weight.
481 // We add up all the other known edges and set the weight on
485 // all edges will get a weight, or iteration will stop when
490 // If we already know the weight of all edges, the weight of the
497 << " known. Set weight for block: ";
504 // visited, then we can compute E's weight.
511 DEBUG(dbgs() << "Set weight for edge: ";
516 // We have a self-referential edge and the weight of BB is known.
523 DEBUG(dbgs() << "Set self-referential edge weight to: ";
566 /// - If BB has a single predecessor/successor, then the weight
567 /// of that edge is the weight of the block.
570 /// weight of the block is already known, the weight of the unknown
571 /// edge will be the weight of the block minus the sum of all the known
572 /// edges. If the sum of all the known edges is larger than BB's weight,
573 /// we set the unknown edge weight to zero.
575 /// - If there is a self-referential edge, and the weight of the block is
576 /// known, the weight for that edge is set to the weight of the block
577 /// minus the weight of the other incoming edges to that block (if
614 unsigned Weight = EdgeWeights[E];
616 Weights.push_back(Weight);
617 if (Weight != 0)
621 // Only set weights if there is at least one non-zero weight.
657 /// \brief Generate branch weight metadata for all branches in \p F.
663 /// are initial assigned the same weight as their most frequently
668 /// blocks in the same equivalence class to the same weight. To compute
677 /// - If BB has a single predecessor/successor, then the weight
678 /// of that edge is the weight of the block.
680 /// - If all the edges are known except one, and the weight of the
681 /// block is already known, the weight of the unknown edge will
682 /// be the weight of the block minus the sum of all the known
683 /// edges. If the sum of all the known edges is larger than BB's weight,
684 /// we set the unknown edge weight to zero.
686 /// - If there is a self-referential edge, and the weight of the block is
687 /// known, the weight for that edge is set to the weight of the block
688 /// minus the weight of the other incoming edges to that block (if