Home | History | Annotate | Download | only in Scalar

Lines Matching refs:Factor

80   /// factor of some product.
81 struct Factor {
85 Factor(Value *Base, unsigned Power) : Base(Base), Power(Power) {}
89 bool operator()(const Factor &LHS, const Factor &RHS) {
96 bool operator()(const Factor &LHS, const Factor &RHS) {
180 SmallVectorImpl<Factor> &Factors);
182 SmallVectorImpl<Factor> &Factors);
184 Value *RemoveFactorFromExpression(Value *V, Value *Factor);
1094 /// and if this sequence contains a multiply by Factor,
1095 /// remove Factor from the tree and return the new tree.
1096 Value *Reassociate::RemoveFactorFromExpression(Value *V, Value *Factor) {
1114 if (Factors[i].Op == Factor) {
1120 // If this is a negative version of this factor, remove it.
1121 if (ConstantInt *FC1 = dyn_cast<ConstantInt>(Factor)) {
1128 } else if (ConstantFP *FC1 = dyn_cast<ConstantFP>(Factor)) {
1169 /// Ops is the top-level list of add operands we're trying to factor.
1488 // Check to see if we've seen this operand before. If so, we factor all
1506 Instruction *Mul = CreateMul(TheOp, C, "factor", I, I);
1572 // To efficiently find this, we count the number of times a factor occurs
1591 // Add one to FactorOccurrences for each unique factor in this op.
1594 Value *Factor = Factors[i];
1595 if (!Duplicates.insert(Factor).second)
1598 unsigned Occ = ++FactorOccurrences[Factor];
1601 MaxOccVal = Factor;
1604 // If Factor is a negative constant, add the negated value as a factor
1607 if (ConstantInt *CI = dyn_cast<ConstantInt>(Factor)) {
1609 Factor = ConstantInt::get(CI->getContext(), -CI->getValue());
1610 assert(!Duplicates.count(Factor) &&
1612 unsigned Occ = ++FactorOccurrences[Factor];
1615 MaxOccVal = Factor;
1618 } else if (ConstantFP *CF = dyn_cast<ConstantFP>(Factor)) {
1622 Factor = ConstantFP::get(CF->getContext(), F);
1623 assert(!Duplicates.count(Factor) &&
1625 unsigned Occ = ++FactorOccurrences[Factor];
1628 MaxOccVal = Factor;
1635 // If any factor occurred more than one time, we can pull it out.
1641 // this, we could otherwise run into situations where removing a factor
1692 // If every add operand included the factor (e.g. "A*B + A*C"), then the
1697 // Otherwise, we had some input that didn't have the factor, such as
1718 SmallVectorImpl<Factor> &Factors) {
1756 Factors.push_back(Factor(Op, Count));
1760 // None of the adjustments above should have reduced the sum of factor powers
1764 std::stable_sort(Factors.begin(), Factors.end(), Factor::PowerDescendingSorter());
1792 SmallVectorImpl<Factor> &Factors) {
1812 // Reset the base value of the first factor to the new expression tree.
1823 Factor::PowerEqual()),
1826 // Iteratively collect the base of each factor with an add power into the
1856 SmallVector<Factor, 4> Factors;