Lines Matching refs:Ops
76 static void PrintOps(Instruction *I, const SmallVectorImpl<ValueEntry> &Ops) { in PrintOps() argument
79 << *Ops[0].Op->getType() << '\t'; in PrintOps()
80 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in PrintOps()
82 Ops[i].Op->printAsOperand(dbgs(), false, M); in PrintOps()
83 dbgs() << ", #" << Ops[i].Rank << "] "; in PrintOps()
449 SmallVectorImpl<RepeatedValue> &Ops) { in LinearizeExprTree() argument
612 Ops.push_back(std::make_pair(V, Weight)); in LinearizeExprTree()
618 if (Ops.empty()) { in LinearizeExprTree()
621 Ops.emplace_back(Identity, APInt(Bitwidth, 1)); in LinearizeExprTree()
630 SmallVectorImpl<ValueEntry> &Ops) { in RewriteExprTree() argument
631 assert(Ops.size() > 1 && "Single values should be used directly!"); in RewriteExprTree()
659 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in RewriteExprTree()
660 NotRewritable.insert(Ops[i].Op); in RewriteExprTree()
670 if (i+2 == Ops.size()) { in RewriteExprTree()
671 Value *NewLHS = Ops[i].Op; in RewriteExprTree()
672 Value *NewRHS = Ops[i+1].Op; in RewriteExprTree()
716 Value *NewRHS = Ops[i].Op; in RewriteExprTree()
975 static unsigned FindInOperandList(const SmallVectorImpl<ValueEntry> &Ops, in FindInOperandList() argument
977 unsigned XRank = Ops[i].Rank; in FindInOperandList()
978 unsigned e = Ops.size(); in FindInOperandList()
979 for (unsigned j = i+1; j != e && Ops[j].Rank == XRank; ++j) { in FindInOperandList()
980 if (Ops[j].Op == X) in FindInOperandList()
982 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op)) in FindInOperandList()
988 for (unsigned j = i-1; j != ~0U && Ops[j].Rank == XRank; --j) { in FindInOperandList()
989 if (Ops[j].Op == X) in FindInOperandList()
991 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op)) in FindInOperandList()
1002 SmallVectorImpl<WeakTrackingVH> &Ops) { in EmitAddTreeOfValues() argument
1003 if (Ops.size() == 1) return Ops.back(); in EmitAddTreeOfValues()
1005 Value *V1 = Ops.back(); in EmitAddTreeOfValues()
1006 Ops.pop_back(); in EmitAddTreeOfValues()
1007 Value *V2 = EmitAddTreeOfValues(I, Ops); in EmitAddTreeOfValues()
1105 SmallVectorImpl<ValueEntry> &Ops) { in OptimizeAndOrXor() argument
1108 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in OptimizeAndOrXor()
1110 assert(i < Ops.size()); in OptimizeAndOrXor()
1112 if (match(Ops[i].Op, m_Not(m_Value(X)))) { // Cannot occur for ^. in OptimizeAndOrXor()
1113 unsigned FoundX = FindInOperandList(Ops, i, X); in OptimizeAndOrXor()
1125 assert(i < Ops.size()); in OptimizeAndOrXor()
1126 if (i+1 != Ops.size() && Ops[i+1].Op == Ops[i].Op) { in OptimizeAndOrXor()
1129 Ops.erase(Ops.begin()+i); in OptimizeAndOrXor()
1138 return Constant::getNullValue(Ops[0].Op->getType()); in OptimizeAndOrXor()
1141 Ops.erase(Ops.begin()+i, Ops.begin()+i+2); in OptimizeAndOrXor()
1285 SmallVectorImpl<ValueEntry> &Ops) { in OptimizeXor() argument
1286 if (Value *V = OptimizeAndOrXor(Instruction::Xor, Ops)) in OptimizeXor()
1289 if (Ops.size() == 1) in OptimizeXor()
1294 Type *Ty = Ops[0].Op->getType(); in OptimizeXor()
1298 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in OptimizeXor()
1299 Value *V = Ops[i].Op; in OptimizeXor()
1380 Ops.clear(); in OptimizeXor()
1386 Ops.push_back(VE); in OptimizeXor()
1391 Ops.push_back(VE); in OptimizeXor()
1393 unsigned Sz = Ops.size(); in OptimizeXor()
1395 return Ops.back().Op; in OptimizeXor()
1409 SmallVectorImpl<ValueEntry> &Ops) { in OptimizeAdd() argument
1415 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in OptimizeAdd()
1416 Value *TheOp = Ops[i].Op; in OptimizeAdd()
1420 if (i+1 != Ops.size() && Ops[i+1].Op == TheOp) { in OptimizeAdd()
1424 Ops.erase(Ops.begin()+i); in OptimizeAdd()
1426 } while (i != Ops.size() && Ops[i].Op == TheOp); in OptimizeAdd()
1444 if (Ops.empty()) in OptimizeAdd()
1450 Ops.insert(Ops.begin(), ValueEntry(getRank(Mul), Mul)); in OptimizeAdd()
1453 e = Ops.size(); in OptimizeAdd()
1463 unsigned FoundX = FindInOperandList(Ops, i, X); in OptimizeAdd()
1468 if (Ops.size() == 2 && in OptimizeAdd()
1473 if (Ops.size() == 2 && match(TheOp, m_Not(m_Value()))) in OptimizeAdd()
1476 Ops.erase(Ops.begin()+i); in OptimizeAdd()
1481 Ops.erase(Ops.begin()+FoundX); in OptimizeAdd()
1489 Ops.insert(Ops.end(), ValueEntry(getRank(V), V)); in OptimizeAdd()
1505 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in OptimizeAdd()
1507 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul); in OptimizeAdd()
1576 for (unsigned i = 0; i != Ops.size(); ++i) { in OptimizeAdd()
1579 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul); in OptimizeAdd()
1583 if (Value *V = RemoveFactorFromExpression(Ops[i].Op, MaxOccVal)) { in OptimizeAdd()
1586 for (unsigned j = Ops.size(); j != i;) { in OptimizeAdd()
1588 if (Ops[j].Op == Ops[i].Op) { in OptimizeAdd()
1590 Ops.erase(Ops.begin()+j); in OptimizeAdd()
1620 if (Ops.empty()) in OptimizeAdd()
1626 Ops.insert(Ops.begin(), ValueEntry(getRank(V2), V2)); in OptimizeAdd()
1643 static bool collectMultiplyFactors(SmallVectorImpl<ValueEntry> &Ops, in collectMultiplyFactors() argument
1648 for (unsigned Idx = 1, Size = Ops.size(); Idx < Size; ++Idx) { in collectMultiplyFactors()
1649 Value *Op = Ops[Idx-1].Op; in collectMultiplyFactors()
1653 for (; Idx < Size && Ops[Idx].Op == Op; ++Idx) in collectMultiplyFactors()
1669 for (unsigned Idx = 1; Idx < Ops.size(); ++Idx) { in collectMultiplyFactors()
1670 Value *Op = Ops[Idx-1].Op; in collectMultiplyFactors()
1674 for (; Idx < Ops.size() && Ops[Idx].Op == Op; ++Idx) in collectMultiplyFactors()
1683 Ops.erase(Ops.begin()+Idx, Ops.begin()+Idx+Count); in collectMultiplyFactors()
1699 SmallVectorImpl<Value*> &Ops) { in buildMultiplyTree() argument
1700 if (Ops.size() == 1) in buildMultiplyTree()
1701 return Ops.back(); in buildMultiplyTree()
1703 Value *LHS = Ops.pop_back_val(); in buildMultiplyTree()
1706 LHS = Builder.CreateMul(LHS, Ops.pop_back_val()); in buildMultiplyTree()
1708 LHS = Builder.CreateFMul(LHS, Ops.pop_back_val()); in buildMultiplyTree()
1709 } while (!Ops.empty()); in buildMultiplyTree()
1779 SmallVectorImpl<ValueEntry> &Ops) { in OptimizeMul() argument
1782 if (Ops.size() < 4) in OptimizeMul()
1789 if (!collectMultiplyFactors(Ops, Factors)) in OptimizeMul()
1800 if (Ops.empty()) in OptimizeMul()
1804 Ops.insert(std::lower_bound(Ops.begin(), Ops.end(), NewEntry), NewEntry); in OptimizeMul()
1809 SmallVectorImpl<ValueEntry> &Ops) { in OptimizeExpression() argument
1814 while (!Ops.empty() && isa<Constant>(Ops.back().Op)) { in OptimizeExpression()
1815 Constant *C = cast<Constant>(Ops.pop_back_val().Op); in OptimizeExpression()
1819 if (Ops.empty()) in OptimizeExpression()
1828 Ops.push_back(ValueEntry(0, Cst)); in OptimizeExpression()
1831 if (Ops.size() == 1) return Ops[0].Op; in OptimizeExpression()
1835 unsigned NumOps = Ops.size(); in OptimizeExpression()
1840 if (Value *Result = OptimizeAndOrXor(Opcode, Ops)) in OptimizeExpression()
1845 if (Value *Result = OptimizeXor(I, Ops)) in OptimizeExpression()
1851 if (Value *Result = OptimizeAdd(I, Ops)) in OptimizeExpression()
1857 if (Value *Result = OptimizeMul(I, Ops)) in OptimizeExpression()
1862 if (Ops.size() != NumOps) in OptimizeExpression()
1863 return OptimizeExpression(I, Ops); in OptimizeExpression()
1872 SmallVector<Value *, 4> Ops(I->op_begin(), I->op_end()); in RecursivelyEraseDeadInsts() local
1877 for (auto Op : Ops) in RecursivelyEraseDeadInsts()
1888 SmallVector<Value*, 8> Ops(I->op_begin(), I->op_end()); in EraseInst() local
1895 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in EraseInst()
1896 if (Instruction *Op = dyn_cast<Instruction>(Ops[i])) { in EraseInst()
2129 SmallVector<ValueEntry, 8> Ops; in ReassociateExpression() local
2130 Ops.reserve(Tree.size()); in ReassociateExpression()
2133 Ops.append(E.second.getZExtValue(), in ReassociateExpression()
2137 LLVM_DEBUG(dbgs() << "RAIn:\t"; PrintOps(I, Ops); dbgs() << '\n'); in ReassociateExpression()
2145 std::stable_sort(Ops.begin(), Ops.end()); in ReassociateExpression()
2149 if (Value *V = OptimizeExpression(I, Ops)) { in ReassociateExpression()
2172 isa<ConstantInt>(Ops.back().Op) && in ReassociateExpression()
2173 cast<ConstantInt>(Ops.back().Op)->isMinusOne()) { in ReassociateExpression()
2174 ValueEntry Tmp = Ops.pop_back_val(); in ReassociateExpression()
2175 Ops.insert(Ops.begin(), Tmp); in ReassociateExpression()
2179 isa<ConstantFP>(Ops.back().Op) && in ReassociateExpression()
2180 cast<ConstantFP>(Ops.back().Op)->isExactlyValue(-1.0)) { in ReassociateExpression()
2181 ValueEntry Tmp = Ops.pop_back_val(); in ReassociateExpression()
2182 Ops.insert(Ops.begin(), Tmp); in ReassociateExpression()
2186 LLVM_DEBUG(dbgs() << "RAOut:\t"; PrintOps(I, Ops); dbgs() << '\n'); in ReassociateExpression()
2188 if (Ops.size() == 1) { in ReassociateExpression()
2189 if (Ops[0].Op == I) in ReassociateExpression()
2195 I->replaceAllUsesWith(Ops[0].Op); in ReassociateExpression()
2196 if (Instruction *OI = dyn_cast<Instruction>(Ops[0].Op)) in ReassociateExpression()
2202 if (Ops.size() > 2 && Ops.size() <= GlobalReassociateLimit) { in ReassociateExpression()
2213 for (unsigned i = 0; i < Ops.size() - 1; ++i) in ReassociateExpression()
2214 for (unsigned j = i + 1; j < Ops.size(); ++j) { in ReassociateExpression()
2216 Value *Op0 = Ops[i].Op; in ReassociateExpression()
2217 Value *Op1 = Ops[j].Op; in ReassociateExpression()
2224 unsigned MaxRank = std::max(Ops[i].Rank, Ops[j].Rank); in ReassociateExpression()
2232 auto Op0 = Ops[BestPair.first]; in ReassociateExpression()
2233 auto Op1 = Ops[BestPair.second]; in ReassociateExpression()
2234 Ops.erase(&Ops[BestPair.second]); in ReassociateExpression()
2235 Ops.erase(&Ops[BestPair.first]); in ReassociateExpression()
2236 Ops.push_back(Op0); in ReassociateExpression()
2237 Ops.push_back(Op1); in ReassociateExpression()
2242 RewriteExprTree(I, Ops); in ReassociateExpression()
2261 SmallVector<Value *, 8> Ops; in BuildPairMap() local
2262 while (!Worklist.empty() && Ops.size() <= GlobalReassociateLimit) { in BuildPairMap()
2266 Ops.push_back(Op); in BuildPairMap()
2276 if (Ops.size() > GlobalReassociateLimit) in BuildPairMap()
2282 for (unsigned i = 0; i < Ops.size() - 1; ++i) { in BuildPairMap()
2283 for (unsigned j = i + 1; j < Ops.size(); ++j) { in BuildPairMap()
2285 Value *Op0 = Ops[i]; in BuildPairMap()
2286 Value *Op1 = Ops[j]; in BuildPairMap()