Home | History | Annotate | Download | only in Scalar

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.
141 SmallVectorImpl<Factor> &Factors);
143 SmallVectorImpl<Factor> &Factors);
925 SmallVector<ValueEntry, 8> Factors;
926 Factors.reserve(Tree.size());
929 Factors.append(E.second.getZExtValue(),
935 for (unsigned i = 0, e = Factors.size(); i != e; ++i) {
936 if (Factors[i].Op == Factor) {
938 Factors.erase(Factors.begin()+i);
944 if (ConstantInt *FC2 = dyn_cast<ConstantInt>(Factors[i].Op))
947 Factors.erase(Factors.begin()+i);
954 RewriteExprTree(BO, Factors);
962 if (Factors.size() == 1) {
964 V = Factors[0].Op;
966 RewriteExprTree(BO, Factors);
977 /// add its operands as factors, otherwise add V to the list of factors.
981 SmallVectorImpl<Value*> &Factors,
985 Factors.push_back(V);
989 // Otherwise, add the LHS and RHS to the list of factors.
990 FindSingleUseMultiplyFactors(BO->getOperand(1), Factors, Ops);
991 FindSingleUseMultiplyFactors(BO->getOperand(0), Factors, Ops);
1117 // Scan the operand list, checking to see if there are any common factors
1133 // Compute all of the factors of this added value.
1134 SmallVector<Value*, 8> Factors;
1135 FindSingleUseMultiplyFactors(BOp, Factors, Ops);
1136 assert(Factors.size() > 1 && "Bad linearize!");
1140 for (unsigned i = 0, e = Factors.size(); i != e; ++i) {
1141 Value *Factor = Factors[i];
1154 "Shouldn't have two constant factors, missed a canonicalize");
1174 // Only try to remove factors from expressions we're allowed to.
1243 /// Given a series of multiplication operands, build a vector of factors and
1251 /// \returns Whether any factors have a power greater than one.
1253 SmallVectorImpl<Factor> &Factors) {
1255 // Compute the sum of powers of simplifiable factors.
1264 // Track for simplification all factors which occur 2 or more times.
1269 // We can only simplify factors if the sum of the powers of our simplifiable
1270 // factors is 4 or higher. When that is the case, we will *always* have
1276 // Now gather the simplifiable factors, removing them from Ops.
1287 // Move an even number of occurrences to Factors.
1291 Factors.push_back(Factor(Op, Count));
1299 std::sort(Factors.begin(), Factors.end(), Factor::PowerDescendingSorter());
1324 SmallVectorImpl<Factor> &Factors) {
1325 assert(Factors[0].Power);
1327 for (unsigned LastIdx = 0, Idx = 1, Size = Factors.size();
1328 Idx < Size && Factors[Idx].Power > 0; ++Idx) {
1329 if (Factors[Idx].Power != Factors[LastIdx].Power) {
1334 // We want to multiply across all the factors with the same power so that
1338 InnerProduct.push_back(Factors[LastIdx].Base);
1340 InnerProduct.push_back(Factors[Idx].Base);
1342 } while (Idx < Size && Factors[Idx].Power == Factors[LastIdx].Power);
1345 // We'll remove all the factors with the same power in a second pass.
1346 Value *M = Factors[LastIdx].Base = buildMultiplyTree(Builder, InnerProduct);
1352 // Unique factors with equal powers -- we've folded them into the first one's
1354 Factors.erase(std::unique(Factors.begin(), Factors.end(),
1356 Factors.end());
1361 for (unsigned Idx = 0, Size = Factors.size(); Idx != Size; ++Idx) {
1362 if (Factors[Idx].Power & 1)
1363 OuterProduct.push_back(Factors[Idx].Base);
1364 Factors[Idx].Power >>= 1;
1366 if (Factors[0].Power) {
1367 Value *SquareRoot = buildMinimalMultiplyDAG(Builder, Factors);
1388 SmallVector<Factor, 4> Factors;
1389 if (!collectMultiplyFactors(Ops, Factors))
1390 return 0; // All distinct factors, so nothing left for us to do.
1393 Value *V = buildMinimalMultiplyDAG(Builder, Factors);