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.
1062 static unsigned FindInOperandList(const SmallVectorImpl<ValueEntry> &Ops,
1064 unsigned XRank = Ops[i].Rank;
1065 unsigned e = Ops.size();
1066 for (unsigned j = i+1; j != e && Ops[j].Rank == XRank; ++j) {
1067 if (Ops[j].Op == X)
1069 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1075 for (unsigned j = i-1; j != ~0U && Ops[j].Rank == XRank; --j) {
1076 if (Ops[j].Op == X)
1078 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1086 /// Emit a tree of add instructions, summing Ops together
1089 SmallVectorImpl<WeakTrackingVH> &Ops) {
1090 if (Ops.size() == 1) return Ops.back();
1092 Value *V1 = Ops.pop_back_val();
1093 Value *V2 = EmitAddTreeOfValues(It, Ops);
1173 /// Ops is the top-level list of add operands we're trying to factor.
1189 /// it is returned, otherwise the Ops list is mutated as necessary.
1191 SmallVectorImpl<ValueEntry> &Ops) {
1194 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1196 assert(i < Ops.size());
1198 if (match(Ops[i].Op, m_Not(m_Value(X)))) { // Cannot occur for ^.
1199 unsigned FoundX = FindInOperandList(Ops, i, X);
1211 assert(i < Ops.size());
1212 if (i+1 != Ops.size() && Ops[i+1].Op == Ops[i].Op) {
1215 Ops.erase(Ops.begin()+i);
1224 return Constant::getNullValue(Ops[0].Op->getType());
1227 Ops.erase(Ops.begin()+i, Ops.begin()+i+2);
1368 /// to a single Value, it is returned, otherwise the Ops list is mutated as
1371 SmallVectorImpl<ValueEntry> &Ops) {
1372 if (Value *V = OptimizeAndOrXor(Instruction::Xor, Ops))
1375 if (Ops.size() == 1)
1380 Type *Ty = Ops[0].Op->getType();
1384 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1385 Value *V = Ops[i].Op;
1463 // Step 4: Reassemble the Ops
1465 Ops.clear();
1470 Ops.push_back(VE);
1475 Ops.push_back(VE);
1477 unsigned Sz = Ops.size();
1479 return Ops.back().Op;
1491 /// is returned, otherwise the Ops list is mutated as necessary.
1493 SmallVectorImpl<ValueEntry> &Ops) {
1499 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1500 Value *TheOp = Ops[i].Op;
1504 if (i+1 != Ops.size() && Ops[i+1].Op == TheOp) {
1508 Ops.erase(Ops.begin()+i);
1510 } while (i != Ops.size() && Ops[i].Op == TheOp);
1528 if (Ops.empty())
1534 Ops.insert(Ops.begin(), ValueEntry(getRank(Mul), Mul));
1537 e = Ops.size();
1547 unsigned FoundX = FindInOperandList(Ops, i, X);
1552 if (Ops.size() == 2 &&
1557 if (Ops.size() == 2 && match(TheOp, m_Not(m_Value())))
1560 Ops.erase(Ops.begin()+i);
1565 Ops.erase(Ops.begin()+FoundX);
1573 Ops.insert(Ops.end(), ValueEntry(getRank(V), V));
1589 for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
1591 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1659 for (unsigned i = 0; i != Ops.size(); ++i) {
1662 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1666 if (Value *V = RemoveFactorFromExpression(Ops[i].Op, MaxOccVal)) {
1669 for (unsigned j = Ops.size(); j != i;) {
1671 if (Ops[j].Op == Ops[i].Op) {
1673 Ops.erase(Ops.begin()+j);
1703 if (Ops.empty())
1709 Ops.insert(Ops.begin(), ValueEntry(getRank(V2), V2));
1726 static bool collectMultiplyFactors(SmallVectorImpl<ValueEntry> &Ops,
1728 // FIXME: Have Ops be (ValueEntry, Multiplicity) pairs, simplifying this.
1731 for (unsigned Idx = 1, Size = Ops.size(); Idx < Size; ++Idx) {
1732 Value *Op = Ops[Idx-1].Op;
1736 for (; Idx < Size && Ops[Idx].Op == Op; ++Idx)
1750 // Now gather the simplifiable factors, removing them from Ops.
1752 for (unsigned Idx = 1; Idx < Ops.size(); ++Idx) {
1753 Value *Op = Ops[Idx-1].Op;
1757 for (; Idx < Ops.size() && Ops[Idx].Op == Op; ++Idx)
1766 Ops.erase(Ops.begin()+Idx, Ops.begin()+Idx+Count);
1779 /// Build a tree of multiplies, computing the product of Ops.
1781 SmallVectorImpl<Value*> &Ops) {
1782 if (Ops.size() == 1)
1783 return Ops.back();
1785 Value *LHS = Ops.pop_back_val();
1788 LHS = Builder.CreateMul(LHS, Ops.pop_back_val());
1790 LHS = Builder.CreateFMul(LHS, Ops.pop_back_val());
1791 } while (!Ops.empty());
1861 SmallVectorImpl<ValueEntry> &Ops) {
1864 if (Ops.size() < 4)
1871 if (!collectMultiplyFactors(Ops, Factors))
1882 if (Ops.empty())
1886 Ops.insert(llvm::lower_bound(Ops, NewEntry), NewEntry);
1891 SmallVectorImpl<ValueEntry> &Ops) {
1897 while (!Ops.empty()) {
1898 if (auto *C = dyn_cast<Constant>(Ops.back().Op)) {
1900 Ops.pop_back();
1905 Ops.pop_back();
1913 if (Ops.empty())
1922 Ops.push_back(ValueEntry(0, Cst));
1925 if (Ops.size() == 1) return Ops[0].Op;
1929 unsigned NumOps = Ops.size();
1934 if (Value *Result = OptimizeAndOrXor(Opcode, Ops))
1939 if (Value *Result = OptimizeXor(I, Ops))
1945 if (Value *Result = OptimizeAdd(I, Ops))
1951 if (Value *Result = OptimizeMul(I, Ops))
1956 if (Ops.size() != NumOps)
1957 return OptimizeExpression(I, Ops);
1966 SmallVector<Value *, 4> Ops(I->operands());
1972 for (auto *Op : Ops)
1983 SmallVector<Value *, 8> Ops(I->operands());
1991 for (Value *V : Ops)
2288 SmallVector<ValueEntry, 8> Ops;
2289 Ops.reserve(Tree.size());
2291 Ops.append(E.second, ValueEntry(getRank(E.first), E.first));
2293 LLVM_DEBUG(dbgs() << "RAIn:\t"; PrintOps(I, Ops); dbgs() << '\n');
2301 llvm::stable_sort(Ops);
2305 if (Value *V = OptimizeExpression(I, Ops)) {
2328 isa<ConstantInt>(Ops.back().Op) &&
2329 cast<ConstantInt>(Ops.back().Op)->isMinusOne()) {
2330 ValueEntry Tmp = Ops.pop_back_val();
2331 Ops.insert(Ops.begin(), Tmp);
2335 isa<ConstantFP>(Ops.back().Op) &&
2336 cast<ConstantFP>(Ops.back().Op)->isExactlyValue(-1.0)) {
2337 ValueEntry Tmp = Ops.pop_back_val();
2338 Ops.insert(Ops.begin(), Tmp);
2342 LLVM_DEBUG(dbgs() << "RAOut:\t"; PrintOps(I, Ops); dbgs() << '\n');
2344 if (Ops.size() == 1) {
2345 if (Ops[0].Op == I)
2351 I->replaceAllUsesWith(Ops[0].Op);
2352 if (Instruction *OI = dyn_cast<Instruction>(Ops[0].Op))
2358 if (Ops.size() > 2 && Ops.size() <= GlobalReassociateLimit) {
2379 int StartIdx = Ops.size() - 1;
2385 const Value *Val = Ops[i].Op;
2427 for (unsigned i = Ops.size() - 1; i > LimitIdx; --i) {
2431 Value *Op0 = Ops[i].Op;
2432 Value *Op1 = Ops[j].Op;
2446 unsigned MaxRank = std::max(Ops[i].Rank, Ops[j].Rank);
2468 auto Op0 = Ops[BestPair.first];
2469 auto Op1 = Ops[BestPair.second];
2470 Ops.erase(&Ops[BestPair.second]);
2471 Ops.erase(&Ops[BestPair.first]);
2472 Ops.push_back(Op0);
2473 Ops.push_back(Op1);
2476 LLVM_DEBUG(dbgs() << "RAOut after CSE reorder:\t"; PrintOps(I, Ops);
2480 RewriteExprTree(I, Ops, Flags);
2499 SmallVector<Value *, 8> Ops;
2500 while (!Worklist.empty() && Ops.size() <= GlobalReassociateLimit) {
2504 Ops.push_back(Op);
2514 if (Ops.size() > GlobalReassociateLimit)
2520 for (unsigned i = 0; i < Ops.size() - 1; ++i) {
2521 for (unsigned j = i + 1; j < Ops.size(); ++j) {
2523 Value *Op0 = Ops[i];
2524 Value *Op1 = Ops[j];