Lines Matching full:factors

1108   SmallVector<ValueEntry, 8> Factors;  in RemoveFactorFromExpression()  local
1109 Factors.reserve(Tree.size()); in RemoveFactorFromExpression()
1112 Factors.append(E.second, ValueEntry(getRank(E.first), E.first)); in RemoveFactorFromExpression()
1117 for (unsigned i = 0, e = Factors.size(); i != e; ++i) { in RemoveFactorFromExpression()
1118 if (Factors[i].Op == Factor) { in RemoveFactorFromExpression()
1120 Factors.erase(Factors.begin()+i); in RemoveFactorFromExpression()
1126 if (ConstantInt *FC2 = dyn_cast<ConstantInt>(Factors[i].Op)) in RemoveFactorFromExpression()
1129 Factors.erase(Factors.begin()+i); in RemoveFactorFromExpression()
1133 if (ConstantFP *FC2 = dyn_cast<ConstantFP>(Factors[i].Op)) { in RemoveFactorFromExpression()
1139 Factors.erase(Factors.begin() + i); in RemoveFactorFromExpression()
1148 RewriteExprTree(BO, Factors, Flags); in RemoveFactorFromExpression()
1156 if (Factors.size() == 1) { in RemoveFactorFromExpression()
1158 V = Factors[0].Op; in RemoveFactorFromExpression()
1160 RewriteExprTree(BO, Factors, Flags); in RemoveFactorFromExpression()
1170 /// If V is a single-use multiply, recursively add its operands as factors,
1171 /// otherwise add V to the list of factors.
1175 SmallVectorImpl<Value*> &Factors) { in FindSingleUseMultiplyFactors() argument
1178 Factors.push_back(V); in FindSingleUseMultiplyFactors()
1182 // Otherwise, add the LHS and RHS to the list of factors. in FindSingleUseMultiplyFactors()
1183 FindSingleUseMultiplyFactors(BO->getOperand(1), Factors); in FindSingleUseMultiplyFactors()
1184 FindSingleUseMultiplyFactors(BO->getOperand(0), Factors); in FindSingleUseMultiplyFactors()
1578 // Scan the operand list, checking to see if there are any common factors in OptimizeAdd()
1595 // Compute all of the factors of this added value. in OptimizeAdd()
1596 SmallVector<Value*, 8> Factors; in OptimizeAdd() local
1597 FindSingleUseMultiplyFactors(BOp, Factors); in OptimizeAdd()
1598 assert(Factors.size() > 1 && "Bad linearize!"); in OptimizeAdd()
1602 for (Value *Factor : Factors) { in OptimizeAdd()
1660 // Only try to remove factors from expressions we're allowed to. in OptimizeAdd()
1717 /// Given a series of multiplication operands, build a vector of factors and
1725 /// \returns Whether any factors have a power greater than one.
1727 SmallVectorImpl<Factor> &Factors) { in collectMultiplyFactors() argument
1729 // Compute the sum of powers of simplifiable factors. in collectMultiplyFactors()
1738 // Track for simplification all factors which occur 2 or more times. in collectMultiplyFactors()
1743 // We can only simplify factors if the sum of the powers of our simplifiable in collectMultiplyFactors()
1744 // factors is 4 or higher. When that is the case, we will *always* have in collectMultiplyFactors()
1750 // Now gather the simplifiable factors, removing them from Ops. in collectMultiplyFactors()
1761 // Move an even number of occurrences to Factors. in collectMultiplyFactors()
1765 Factors.push_back(Factor(Op, Count)); in collectMultiplyFactors()
1773 llvm::stable_sort(Factors, [](const Factor &LHS, const Factor &RHS) { in collectMultiplyFactors()
1804 SmallVectorImpl<Factor> &Factors) { in buildMinimalMultiplyDAG() argument
1805 assert(Factors[0].Power); in buildMinimalMultiplyDAG()
1807 for (unsigned LastIdx = 0, Idx = 1, Size = Factors.size(); in buildMinimalMultiplyDAG()
1808 Idx < Size && Factors[Idx].Power > 0; ++Idx) { in buildMinimalMultiplyDAG()
1809 if (Factors[Idx].Power != Factors[LastIdx].Power) { in buildMinimalMultiplyDAG()
1814 // We want to multiply across all the factors with the same power so that in buildMinimalMultiplyDAG()
1818 InnerProduct.push_back(Factors[LastIdx].Base); in buildMinimalMultiplyDAG()
1820 InnerProduct.push_back(Factors[Idx].Base); in buildMinimalMultiplyDAG()
1822 } while (Idx < Size && Factors[Idx].Power == Factors[LastIdx].Power); in buildMinimalMultiplyDAG()
1825 // We'll remove all the factors with the same power in a second pass. in buildMinimalMultiplyDAG()
1826 Value *M = Factors[LastIdx].Base = buildMultiplyTree(Builder, InnerProduct); in buildMinimalMultiplyDAG()
1832 // Unique factors with equal powers -- we've folded them into the first one's in buildMinimalMultiplyDAG()
1834 Factors.erase(llvm::unique(Factors, in buildMinimalMultiplyDAG()
1838 Factors.end()); in buildMinimalMultiplyDAG()
1843 for (Factor &F : Factors) { in buildMinimalMultiplyDAG()
1848 if (Factors[0].Power) { in buildMinimalMultiplyDAG()
1849 Value *SquareRoot = buildMinimalMultiplyDAG(Builder, Factors); in buildMinimalMultiplyDAG()
1870 SmallVector<Factor, 4> Factors; in OptimizeMul() local
1871 if (!collectMultiplyFactors(Ops, Factors)) in OptimizeMul()
1872 return nullptr; // All distinct factors, so nothing left for us to do. in OptimizeMul()
1881 Value *V = buildMinimalMultiplyDAG(Builder, Factors); in OptimizeMul()