Home | History | Annotate | Download | only in Scalar

Lines Matching defs: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) {
141 SmallVectorImpl<Factor> &Factors);
143 SmallVectorImpl<Factor> &Factors);
145 Value *RemoveFactorFromExpression(Value *V, Value *Factor);
917 /// multiplication sequence, and if this sequence contains a multiply by Factor,
918 /// remove Factor from the tree and return the new tree.
919 Value *Reassociate::RemoveFactorFromExpression(Value *V, Value *Factor) {
936 if (Factors[i].Op == Factor) {
942 // If this is a negative version of this factor, remove it.
943 if (ConstantInt *FC1 = dyn_cast<ConstantInt>(Factor))
979 /// Ops is the top-level list of add operands we're trying to factor.
1056 // Check to see if we've seen this operand before. If so, we factor all
1072 Mul = BinaryOperator::CreateMul(TheOp, Mul, "factor", I);
1120 // To efficiently find this, we count the number of times a factor occurs
1138 // Add one to FactorOccurrences for each unique factor in this op.
1141 Value *Factor = Factors[i];
1142 if (!Duplicates.insert(Factor)) continue;
1144 unsigned Occ = ++FactorOccurrences[Factor];
1145 if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factor; }
1147 // If Factor is a negative constant, add the negated value as a factor
1150 if (ConstantInt *CI = dyn_cast<ConstantInt>(Factor))
1152 Factor = ConstantInt::get(CI->getContext(), -CI->getValue());
1153 assert(!Duplicates.count(Factor) &&
1156 unsigned Occ = ++FactorOccurrences[Factor];
1157 if (Occ > MaxOcc) { MaxOcc = Occ; MaxOccVal = Factor; }
1162 // If any factor occurred more than one time, we can pull it out.
1168 // this, we could otherwise run into situations where removing a factor
1214 // If every add operand included the factor (e.g. "A*B + A*C"), then the
1219 // Otherwise, we had some input that didn't have the factor, such as
1253 SmallVectorImpl<Factor> &Factors) {
1291 Factors.push_back(Factor(Op, Count));
1295 // None of the adjustments above should have reduced the sum of factor powers
1299 std::sort(Factors.begin(), Factors.end(), Factor::PowerDescendingSorter());
1324 SmallVectorImpl<Factor> &Factors) {
1344 // Reset the base value of the first factor to the new expression tree.
1355 Factor::PowerEqual()),
1358 // Iteratively collect the base of each factor with an add power into the
1388 SmallVector<Factor, 4> Factors;