Home | History | Annotate | Download | only in Scalar

Lines Matching refs:Factor

78   /// factor of some product.
79 struct Factor {
83 Factor(Value *Base, unsigned Power) : Base(Base), Power(Power) {}
87 bool operator()(const Factor &LHS, const Factor &RHS) {
94 bool operator()(const Factor &LHS, const Factor &RHS) {
101 bool operator()(const Factor &LHS, const Factor &RHS) {
108 bool operator()(const Factor &LHS, const Factor &RHS) {
190 SmallVectorImpl<Factor> &Factors);
192 SmallVectorImpl<Factor> &Factors);
194 Value *RemoveFactorFromExpression(Value *V, Value *Factor);
995 /// multiplication sequence, and if this sequence contains a multiply by Factor,
996 /// remove Factor from the tree and return the new tree.
997 Value *Reassociate::RemoveFactorFromExpression(Value *V, Value *Factor) {
1014 if (Factors[i].Op == Factor) {
1020 // If this is a negative version of this factor, remove it.
1021 if (ConstantInt *FC1 = dyn_cast<ConstantInt>(Factor))
1057 /// Ops is the top-level list of add operands we're trying to factor.
1377 // Check to see if we've seen this operand before. If so, we factor all
1393 Mul = BinaryOperator::CreateMul(TheOp, Mul, "factor", I);
1457 // To efficiently find this, we count the number of times a factor occurs
1475 // Add one to FactorOccurrences for each unique factor in this op.
1478 Value *Factor = Factors[i];
1479 if (!Duplicates.insert(Factor)) continue;
1481 unsigned Occ = ++FactorOccurrences[Factor];
1482 if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factor; }
1484 // If Factor is a negative constant, add the negated value as a factor
1487 if (ConstantInt *CI = dyn_cast<ConstantInt>(Factor))
1489 Factor = ConstantInt::get(CI->getContext(), -CI->getValue());
1490 assert(!Duplicates.count(Factor) &&
1493 unsigned Occ = ++FactorOccurrences[Factor];
1494 if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factor; }
1499 // If any factor occurred more than one time, we can pull it out.
1505 // this, we could otherwise run into situations where removing a factor
1551 // If every add operand included the factor (e.g. "A*B + A*C"), then the
1556 // Otherwise, we had some input that didn't have the factor, such as
1577 SmallVectorImpl<Factor> &Factors) {
1615 Factors.push_back(Factor(Op, Count));
1619 // None of the adjustments above should have reduced the sum of factor powers
1623 std::stable_sort(Factors.begin(), Factors.end(), Factor::PowerDescendingSorter());
1648 SmallVectorImpl<Factor> &Factors) {
1668 // Reset the base value of the first factor to the new expression tree.
1679 Factor::PowerEqual()),
1682 // Iteratively collect the base of each factor with an add power into the
1712 SmallVector<Factor, 4> Factors;