Lines Matching defs:Ops
81 /// Print out the expression identified in the Ops list.
82 static void PrintOps(Instruction *I, const SmallVectorImpl<ValueEntry> &Ops) {
85 << *Ops[0].Op->getType() << '\t';
86 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
88 Ops[i].Op->printAsOperand(dbgs(), false, M);
89 dbgs() << ", #" << Ops[i].Rank << "] ";
308 /// nodes in Ops along with their weights (how many times the leaf occurs). The
310 /// (Ops[0].first op Ops[0].first op ... Ops[0].first) <- Ops[0].second times
312 /// (Ops[1].first op Ops[1].first op ... Ops[1].first) <- Ops[1].second times
316 /// (Ops[N].first op Ops[N].first op ... Ops[N].first) <- Ops[N].second times
318 /// Note that the values Ops[0].first, ..., Ops[N].first are all distinct.
323 /// you MUST either replace I with a new expression computed from the Ops array,
345 /// The leaf nodes are C, E, F and G. The Ops array will contain (maybe not in
381 SmallVectorImpl<RepeatedValue> &Ops,
539 Ops.push_back(std::make_pair(V, Weight));
557 if (Ops.empty()) {
560 Ops.emplace_back(Identity, 1);
569 SmallVectorImpl<ValueEntry> &Ops,
571 assert(Ops.size() > 1 && "Single values should be used directly!");
599 for (const ValueEntry &Op : Ops)
610 // operands will come from Ops, rather than just one with the other being
612 if (i+2 == Ops.size()) {
613 Value *NewLHS = Ops[i].Op;
614 Value *NewRHS = Ops[i+1].Op;
659 // while the right-hand side will be the current element of Ops.
660 Value *NewRHS = Ops[i].Op;
723 // expression tree is dominated by all of Ops.
1064 static unsigned FindInOperandList(const SmallVectorImpl<ValueEntry> &Ops,
1066 unsigned XRank = Ops[i].Rank;
1067 unsigned e = Ops.size();
1068 for (unsigned j = i+1; j != e && Ops[j].Rank == XRank; ++j) {
1069 if (Ops[j].Op == X)
1071 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1077 for (unsigned j = i-1; j != ~0U && Ops[j].Rank == XRank; --j) {
1078 if (Ops[j].Op == X)
1080 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1088 /// Emit a tree of add instructions, summing Ops together
1091 SmallVectorImpl<WeakTrackingVH> &Ops) {
1092 if (Ops.size() == 1) return Ops.back();
1094 Value *V1 = Ops.pop_back_val();
1095 Value *V2 = EmitAddTreeOfValues(It, Ops);
1175 /// Ops is the top-level list of add operands we're trying to factor.
1191 /// it is returned, otherwise the Ops list is mutated as necessary.
1193 SmallVectorImpl<ValueEntry> &Ops) {
1196 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1198 assert(i < Ops.size());
1200 if (match(Ops[i].Op, m_Not(m_Value(X)))) { // Cannot occur for ^.
1201 unsigned FoundX = FindInOperandList(Ops, i, X);
1213 assert(i < Ops.size());
1214 if (i+1 != Ops.size() && Ops[i+1].Op == Ops[i].Op) {
1217 Ops.erase(Ops.begin()+i);
1226 return Constant::getNullValue(Ops[0].Op->getType());
1229 Ops.erase(Ops.begin()+i, Ops.begin()+i+2);
1370 /// to a single Value, it is returned, otherwise the Ops list is mutated as
1373 SmallVectorImpl<ValueEntry> &Ops) {
1374 if (Value *V = OptimizeAndOrXor(Instruction::Xor, Ops))
1377 if (Ops.size() == 1)
1382 Type *Ty = Ops[0].Op->getType();
1386 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1387 Value *V = Ops[i].Op;
1465 // Step 4: Reassemble the Ops
1467 Ops.clear();
1472 Ops.push_back(VE);
1477 Ops.push_back(VE);
1479 unsigned Sz = Ops.size();
1481 return Ops.back().Op;
1493 /// is returned, otherwise the Ops list is mutated as necessary.
1495 SmallVectorImpl<ValueEntry> &Ops) {
1501 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1502 Value *TheOp = Ops[i].Op;
1506 if (i+1 != Ops.size() && Ops[i+1].Op == TheOp) {
1510 Ops.erase(Ops.begin()+i);
1512 } while (i != Ops.size() && Ops[i].Op == TheOp);
1530 if (Ops.empty())
1536 Ops.insert(Ops.begin(), ValueEntry(getRank(Mul), Mul));
1539 e = Ops.size();
1549 unsigned FoundX = FindInOperandList(Ops, i, X);
1554 if (Ops.size() == 2 &&
1559 if (Ops.size() == 2 && match(TheOp, m_Not(m_Value())))
1562 Ops.erase(Ops.begin()+i);
1567 Ops.erase(Ops.begin()+FoundX);
1575 Ops.insert(Ops.end(), ValueEntry(getRank(V), V));
1591 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1593 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1661 for (unsigned i = 0; i != Ops.size(); ++i) {
1664 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1668 if (Value *V = RemoveFactorFromExpression(Ops[i].Op, MaxOccVal)) {
1671 for (unsigned j = Ops.size(); j != i;) {
1673 if (Ops[j].Op == Ops[i].Op) {
1675 Ops.erase(Ops.begin()+j);
1705 if (Ops.empty())
1711 Ops.insert(Ops.begin(), ValueEntry(getRank(V2), V2));
1728 static bool collectMultiplyFactors(SmallVectorImpl<ValueEntry> &Ops,
1730 // FIXME: Have Ops be (ValueEntry, Multiplicity) pairs, simplifying this.
1733 for (unsigned Idx = 1, Size = Ops.size(); Idx < Size; ++Idx) {
1734 Value *Op = Ops[Idx-1].Op;
1738 for (; Idx < Size && Ops[Idx].Op == Op; ++Idx)
1752 // Now gather the simplifiable factors, removing them from Ops.
1754 for (unsigned Idx = 1; Idx < Ops.size(); ++Idx) {
1755 Value *Op = Ops[Idx-1].Op;
1759 for (; Idx < Ops.size() && Ops[Idx].Op == Op; ++Idx)
1768 Ops.erase(Ops.begin()+Idx, Ops.begin()+Idx+Count);
1781 /// Build a tree of multiplies, computing the product of Ops.
1783 SmallVectorImpl<Value*> &Ops) {
1784 if (Ops.size() == 1)
1785 return Ops.back();
1787 Value *LHS = Ops.pop_back_val();
1790 LHS = Builder.CreateMul(LHS, Ops.pop_back_val());
1792 LHS = Builder.CreateFMul(LHS, Ops.pop_back_val());
1793 } while (!Ops.empty());
1863 SmallVectorImpl<ValueEntry> &Ops) {
1866 if (Ops.size() < 4)
1873 if (!collectMultiplyFactors(Ops, Factors))
1884 if (Ops.empty())
1888 Ops.insert(llvm::lower_bound(Ops, NewEntry), NewEntry);
1893 SmallVectorImpl<ValueEntry> &Ops) {
1899 while (!Ops.empty()) {
1900 if (auto *C = dyn_cast<Constant>(Ops.back().Op)) {
1902 Ops.pop_back();
1907 Ops.pop_back();
1915 if (Ops.empty())
1924 Ops.push_back(ValueEntry(0, Cst));
1927 if (Ops.size() == 1) return Ops[0].Op;
1931 unsigned NumOps = Ops.size();
1936 if (Value *Result = OptimizeAndOrXor(Opcode, Ops))
1941 if (Value *Result = OptimizeXor(I, Ops))
1947 if (Value *Result = OptimizeAdd(I, Ops))
1953 if (Value *Result = OptimizeMul(I, Ops))
1958 if (Ops.size() != NumOps)
1959 return OptimizeExpression(I, Ops);
1968 SmallVector<Value *, 4> Ops(I->operands());
1974 for (auto *Op : Ops)
1985 SmallVector<Value *, 8> Ops(I->operands());
1993 for (Value *V : Ops)
2291 SmallVector<ValueEntry, 8> Ops;
2292 Ops.reserve(Tree.size());
2294 Ops.append(E.second, ValueEntry(getRank(E.first), E.first));
2296 LLVM_DEBUG(dbgs() << "RAIn:\t"; PrintOps(I, Ops); dbgs() << '\n');
2304 llvm::stable_sort(Ops);
2308 if (Value *V = OptimizeExpression(I, Ops)) {
2331 isa<ConstantInt>(Ops.back().Op) &&
2332 cast<ConstantInt>(Ops.back().Op)->isMinusOne()) {
2333 ValueEntry Tmp = Ops.pop_back_val();
2334 Ops.insert(Ops.begin(), Tmp);
2338 isa<ConstantFP>(Ops.back().Op) &&
2339 cast<ConstantFP>(Ops.back().Op)->isExactlyValue(-1.0)) {
2340 ValueEntry Tmp = Ops.pop_back_val();
2341 Ops.insert(Ops.begin(), Tmp);
2345 LLVM_DEBUG(dbgs() << "RAOut:\t"; PrintOps(I, Ops); dbgs() << '\n');
2347 if (Ops.size() == 1) {
2348 if (Ops[0].Op == I)
2354 I->replaceAllUsesWith(Ops[0].Op);
2355 if (Instruction *OI = dyn_cast<Instruction>(Ops[0].Op))
2361 if (Ops.size() > 2 && Ops.size() <= GlobalReassociateLimit) {
2382 int StartIdx = Ops.size() - 1;
2388 const Value *Val = Ops[i].Op;
2430 for (unsigned i = Ops.size() - 1; i > LimitIdx; --i) {
2434 Value *Op0 = Ops[i].Op;
2435 Value *Op1 = Ops[j].Op;
2449 unsigned MaxRank = std::max(Ops[i].Rank, Ops[j].Rank);
2471 auto Op0 = Ops[BestPair.first];
2472 auto Op1 = Ops[BestPair.second];
2473 Ops.erase(&Ops[BestPair.second]);
2474 Ops.erase(&Ops[BestPair.first]);
2475 Ops.push_back(Op0);
2476 Ops.push_back(Op1);
2479 LLVM_DEBUG(dbgs() << "RAOut after CSE reorder:\t"; PrintOps(I, Ops);
2483 RewriteExprTree(I, Ops, Flags);
2502 SmallVector<Value *, 8> Ops;
2503 while (!Worklist.empty() && Ops.size() <= GlobalReassociateLimit) {
2507 Ops.push_back(Op);
2517 if (Ops.size() > GlobalReassociateLimit)
2523 for (unsigned i = 0; i < Ops.size() - 1; ++i) {
2524 for (unsigned j = i + 1; j < Ops.size(); ++j) {
2526 Value *Op0 = Ops[i];
2527 Value *Op1 = Ops[j];