Lines Matching refs:Factors
85 /// \brief Sort factors by their Base.
92 /// \brief Compare factors for equal bases.
99 /// \brief Sort factors in descending order by their power.
106 /// \brief Compare factors for equal powers.
190 SmallVectorImpl<Factor> &Factors);
192 SmallVectorImpl<Factor> &Factors);
1004 SmallVector<ValueEntry, 8> Factors;
1005 Factors.reserve(Tree.size());
1008 Factors.append(E.second.getZExtValue(),
1014 for (unsigned i = 0, e = Factors.size(); i != e; ++i) {
1015 if (Factors[i].Op == Factor) {
1017 Factors.erase(Factors.begin()+i);
1023 if (ConstantInt *FC2 = dyn_cast<ConstantInt>(Factors[i].Op))
1026 Factors.erase(Factors.begin()+i);
1033 RewriteExprTree(BO, Factors);
1041 if (Factors.size() == 1) {
1043 V = Factors[0].Op;
1045 RewriteExprTree(BO, Factors);
1056 /// add its operands as factors, otherwise add V to the list of factors.
1060 SmallVectorImpl<Value*> &Factors,
1064 Factors.push_back(V);
1068 // Otherwise, add the LHS and RHS to the list of factors.
1069 FindSingleUseMultiplyFactors(BO->getOperand(1), Factors, Ops);
1070 FindSingleUseMultiplyFactors(BO->getOperand(0), Factors, Ops);
1440 // Scan the operand list, checking to see if there are any common factors
1456 // Compute all of the factors of this added value.
1457 SmallVector<Value*, 8> Factors;
1458 FindSingleUseMultiplyFactors(BOp, Factors, Ops);
1459 assert(Factors.size() > 1 && "Bad linearize!");
1463 for (unsigned i = 0, e = Factors.size(); i != e; ++i) {
1464 Value *Factor = Factors[i];
1477 "Shouldn't have two constant factors, missed a canonicalize");
1497 // Only try to remove factors from expressions we're allowed to.
1566 /// Given a series of multiplication operands, build a vector of factors and
1574 /// \returns Whether any factors have a power greater than one.
1576 SmallVectorImpl<Factor> &Factors) {
1578 // Compute the sum of powers of simplifiable factors.
1587 // Track for simplification all factors which occur 2 or more times.
1592 // We can only simplify factors if the sum of the powers of our simplifiable
1593 // factors is 4 or higher. When that is the case, we will *always* have
1599 // Now gather the simplifiable factors, removing them from Ops.
1610 // Move an even number of occurrences to Factors.
1614 Factors.push_back(Factor(Op, Count));
1622 std::sort(Factors.begin(), Factors.end(), Factor::PowerDescendingSorter());
1647 SmallVectorImpl<Factor> &Factors) {
1648 assert(Factors[0].Power);
1650 for (unsigned LastIdx = 0, Idx = 1, Size = Factors.size();
1651 Idx < Size && Factors[Idx].Power > 0; ++Idx) {
1652 if (Factors[Idx].Power != Factors[LastIdx].Power) {
1657 // We want to multiply across all the factors with the same power so that
1661 InnerProduct.push_back(Factors[LastIdx].Base);
1663 InnerProduct.push_back(Factors[Idx].Base);
1665 } while (Idx < Size && Factors[Idx].Power == Factors[LastIdx].Power);
1668 // We'll remove all the factors with the same power in a second pass.
1669 Value *M = Factors[LastIdx].Base = buildMultiplyTree(Builder, InnerProduct);
1675 // Unique factors with equal powers -- we've folded them into the first one's
1677 FactorsFactors.begin(), Factors.end(),
1679 Factors.end());
1684 for (unsigned Idx = 0, Size = Factors.size(); Idx != Size; ++Idx) {
1685 if (Factors[Idx].Power & 1)
1686 OuterProduct.push_back(Factors[Idx].Base);
1687 Factors[Idx].Power >>= 1;
1689 if (Factors[0].Power) {
1690 Value *SquareRoot = buildMinimalMultiplyDAG(Builder, Factors);
1711 SmallVector<Factor, 4> Factors;
1712 if (!collectMultiplyFactors(Ops, Factors))
1713 return 0; // All distinct factors, so nothing left for us to do.
1716 Value *V = buildMinimalMultiplyDAG(Builder, Factors);