• Home
  • Raw
  • Download

Lines Matching refs:Ops

639 static void GroupByComplexity(SmallVectorImpl<const SCEV *> &Ops,  in GroupByComplexity()  argument
641 if (Ops.size() < 2) return; // Noop in GroupByComplexity()
642 if (Ops.size() == 2) { in GroupByComplexity()
645 const SCEV *&LHS = Ops[0], *&RHS = Ops[1]; in GroupByComplexity()
652 std::stable_sort(Ops.begin(), Ops.end(), SCEVComplexityCompare(LI)); in GroupByComplexity()
658 for (unsigned i = 0, e = Ops.size(); i != e-2; ++i) { in GroupByComplexity()
659 const SCEV *S = Ops[i]; in GroupByComplexity()
664 for (unsigned j = i+1; j != e && Ops[j]->getSCEVType() == Complexity; ++j) { in GroupByComplexity()
665 if (Ops[j] == S) { // Found a duplicate. in GroupByComplexity()
667 std::swap(Ops[i+1], Ops[j]); in GroupByComplexity()
1344 SmallVector<const SCEV *, 4> Ops; in getAnyExtendExpr() local
1347 Ops.push_back(getAnyExtendExpr(*I, Ty)); in getAnyExtendExpr()
1348 return getAddRecExpr(Ops, AR->getLoop(), SCEV::FlagNW); in getAnyExtendExpr()
1388 const SCEV *const *Ops, size_t NumOperands, in CollectAddOperandsWithScales() argument
1395 while (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[i])) { in CollectAddOperandsWithScales()
1406 const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[i]); in CollectAddOperandsWithScales()
1436 M.insert(std::make_pair(Ops[i], Scale)); in CollectAddOperandsWithScales()
1461 const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, in getAddExpr() argument
1465 assert(!Ops.empty() && "Cannot get empty add!"); in getAddExpr()
1466 if (Ops.size() == 1) return Ops[0]; in getAddExpr()
1468 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getAddExpr()
1469 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getAddExpr()
1470 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getAddExpr()
1480 for (SmallVectorImpl<const SCEV *>::const_iterator I = Ops.begin(), in getAddExpr()
1481 E = Ops.end(); I != E; ++I) in getAddExpr()
1490 GroupByComplexity(Ops, LI); in getAddExpr()
1494 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getAddExpr()
1496 assert(Idx < Ops.size()); in getAddExpr()
1497 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getAddExpr()
1499 Ops[0] = getConstant(LHSC->getValue()->getValue() + in getAddExpr()
1501 if (Ops.size() == 2) return Ops[0]; in getAddExpr()
1502 Ops.erase(Ops.begin()+1); // Erase the folded element in getAddExpr()
1503 LHSC = cast<SCEVConstant>(Ops[0]); in getAddExpr()
1508 Ops.erase(Ops.begin()); in getAddExpr()
1512 if (Ops.size() == 1) return Ops[0]; in getAddExpr()
1518 Type *Ty = Ops[0]->getType(); in getAddExpr()
1520 for (unsigned i = 0, e = Ops.size(); i != e-1; ++i) in getAddExpr()
1521 if (Ops[i] == Ops[i+1]) { // X + Y + Y --> X + Y*2 in getAddExpr()
1524 while (i+Count != e && Ops[i+Count] == Ops[i]) in getAddExpr()
1528 const SCEV *Mul = getMulExpr(Scale, Ops[i]); in getAddExpr()
1529 if (Ops.size() == Count) in getAddExpr()
1531 Ops[i] = Mul; in getAddExpr()
1532 Ops.erase(Ops.begin()+i+1, Ops.begin()+i+Count); in getAddExpr()
1537 return getAddExpr(Ops, Flags); in getAddExpr()
1543 for (; Idx < Ops.size() && isa<SCEVTruncateExpr>(Ops[Idx]); ++Idx) { in getAddExpr()
1544 const SCEVTruncateExpr *Trunc = cast<SCEVTruncateExpr>(Ops[Idx]); in getAddExpr()
1551 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in getAddExpr()
1552 if (const SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(Ops[i])) { in getAddExpr()
1558 } else if (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[i])) { in getAddExpr()
1560 } else if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(Ops[i])) { in getAddExpr()
1595 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddExpr) in getAddExpr()
1599 if (Idx < Ops.size()) { in getAddExpr()
1601 while (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[Idx])) { in getAddExpr()
1604 Ops.erase(Ops.begin()+Idx); in getAddExpr()
1605 Ops.append(Add->op_begin(), Add->op_end()); in getAddExpr()
1613 return getAddExpr(Ops); in getAddExpr()
1617 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scMulExpr) in getAddExpr()
1622 if (Idx < Ops.size() && isa<SCEVMulExpr>(Ops[Idx])) { in getAddExpr()
1628 Ops.data(), Ops.size(), in getAddExpr()
1638 Ops.clear(); in getAddExpr()
1640 Ops.push_back(getConstant(AccumulatedConstant)); in getAddExpr()
1644 Ops.push_back(getMulExpr(getConstant(I->first), in getAddExpr()
1646 if (Ops.empty()) in getAddExpr()
1648 if (Ops.size() == 1) in getAddExpr()
1649 return Ops[0]; in getAddExpr()
1650 return getAddExpr(Ops); in getAddExpr()
1657 for (; Idx < Ops.size() && isa<SCEVMulExpr>(Ops[Idx]); ++Idx) { in getAddExpr()
1658 const SCEVMulExpr *Mul = cast<SCEVMulExpr>(Ops[Idx]); in getAddExpr()
1663 for (unsigned AddOp = 0, e = Ops.size(); AddOp != e; ++AddOp) in getAddExpr()
1664 if (MulOpSCEV == Ops[AddOp]) { in getAddExpr()
1678 if (Ops.size() == 2) return OuterMul; in getAddExpr()
1680 Ops.erase(Ops.begin()+AddOp); in getAddExpr()
1681 Ops.erase(Ops.begin()+Idx-1); in getAddExpr()
1683 Ops.erase(Ops.begin()+Idx); in getAddExpr()
1684 Ops.erase(Ops.begin()+AddOp-1); in getAddExpr()
1686 Ops.push_back(OuterMul); in getAddExpr()
1687 return getAddExpr(Ops); in getAddExpr()
1692 OtherMulIdx < Ops.size() && isa<SCEVMulExpr>(Ops[OtherMulIdx]); in getAddExpr()
1694 const SCEVMulExpr *OtherMul = cast<SCEVMulExpr>(Ops[OtherMulIdx]); in getAddExpr()
1717 if (Ops.size() == 2) return OuterMul; in getAddExpr()
1718 Ops.erase(Ops.begin()+Idx); in getAddExpr()
1719 Ops.erase(Ops.begin()+OtherMulIdx-1); in getAddExpr()
1720 Ops.push_back(OuterMul); in getAddExpr()
1721 return getAddExpr(Ops); in getAddExpr()
1730 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddRecExpr) in getAddExpr()
1734 for (; Idx < Ops.size() && isa<SCEVAddRecExpr>(Ops[Idx]); ++Idx) { in getAddExpr()
1738 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getAddExpr()
1740 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getAddExpr()
1741 if (isLoopInvariant(Ops[i], AddRecLoop)) { in getAddExpr()
1742 LIOps.push_back(Ops[i]); in getAddExpr()
1743 Ops.erase(Ops.begin()+i); in getAddExpr()
1763 if (Ops.size() == 1) return NewRec; in getAddExpr()
1767 if (Ops[i] == AddRec) { in getAddExpr()
1768 Ops[i] = NewRec; in getAddExpr()
1771 return getAddExpr(Ops); in getAddExpr()
1778 OtherIdx < Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
1780 if (AddRecLoop == cast<SCEVAddRecExpr>(Ops[OtherIdx])->getLoop()) { in getAddExpr()
1784 for (; OtherIdx != Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
1787 dyn_cast<SCEVAddRecExpr>(Ops[OtherIdx])) in getAddExpr()
1799 Ops.erase(Ops.begin() + OtherIdx); --OtherIdx; in getAddExpr()
1802 Ops[Idx] = getAddRecExpr(AddRecOps, AddRecLoop, SCEV::FlagAnyWrap); in getAddExpr()
1803 return getAddExpr(Ops); in getAddExpr()
1814 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getAddExpr()
1815 ID.AddPointer(Ops[i]); in getAddExpr()
1820 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getAddExpr()
1821 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getAddExpr()
1823 O, Ops.size()); in getAddExpr()
1864 const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops, in getMulExpr() argument
1868 assert(!Ops.empty() && "Cannot get empty mul!"); in getMulExpr()
1869 if (Ops.size() == 1) return Ops[0]; in getMulExpr()
1871 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getMulExpr()
1872 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getMulExpr()
1873 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getMulExpr()
1883 for (SmallVectorImpl<const SCEV *>::const_iterator I = Ops.begin(), in getMulExpr()
1884 E = Ops.end(); I != E; ++I) in getMulExpr()
1893 GroupByComplexity(Ops, LI); in getMulExpr()
1897 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getMulExpr()
1900 if (Ops.size() == 2) in getMulExpr()
1901 if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1])) in getMulExpr()
1908 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getMulExpr()
1913 Ops[0] = getConstant(Fold); in getMulExpr()
1914 Ops.erase(Ops.begin()+1); // Erase the folded element in getMulExpr()
1915 if (Ops.size() == 1) return Ops[0]; in getMulExpr()
1916 LHSC = cast<SCEVConstant>(Ops[0]); in getMulExpr()
1920 if (cast<SCEVConstant>(Ops[0])->getValue()->equalsInt(1)) { in getMulExpr()
1921 Ops.erase(Ops.begin()); in getMulExpr()
1923 } else if (cast<SCEVConstant>(Ops[0])->getValue()->isZero()) { in getMulExpr()
1925 return Ops[0]; in getMulExpr()
1926 } else if (Ops[0]->isAllOnesValue()) { in getMulExpr()
1929 if (Ops.size() == 2) { in getMulExpr()
1930 if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1])) { in getMulExpr()
1935 const SCEV *Mul = getMulExpr(Ops[0], *I); in getMulExpr()
1943 AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) { in getMulExpr()
1948 Operands.push_back(getMulExpr(Ops[0], *I)); in getMulExpr()
1956 if (Ops.size() == 1) in getMulExpr()
1957 return Ops[0]; in getMulExpr()
1961 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scMulExpr) in getMulExpr()
1965 if (Idx < Ops.size()) { in getMulExpr()
1967 while (const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[Idx])) { in getMulExpr()
1970 Ops.erase(Ops.begin()+Idx); in getMulExpr()
1971 Ops.append(Mul->op_begin(), Mul->op_end()); in getMulExpr()
1979 return getMulExpr(Ops); in getMulExpr()
1985 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddRecExpr) in getMulExpr()
1989 for (; Idx < Ops.size() && isa<SCEVAddRecExpr>(Ops[Idx]); ++Idx) { in getMulExpr()
1993 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getMulExpr()
1995 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getMulExpr()
1996 if (isLoopInvariant(Ops[i], AddRecLoop)) { in getMulExpr()
1997 LIOps.push_back(Ops[i]); in getMulExpr()
1998 Ops.erase(Ops.begin()+i); in getMulExpr()
2020 if (Ops.size() == 1) return NewRec; in getMulExpr()
2024 if (Ops[i] == AddRec) { in getMulExpr()
2025 Ops[i] = NewRec; in getMulExpr()
2028 return getMulExpr(Ops); in getMulExpr()
2035 OtherIdx < Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getMulExpr()
2037 if (AddRecLoop != cast<SCEVAddRecExpr>(Ops[OtherIdx])->getLoop()) in getMulExpr()
2051 for (; OtherIdx != Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getMulExpr()
2054 dyn_cast<SCEVAddRecExpr>(Ops[OtherIdx]); in getMulExpr()
2087 if (Ops.size() == 2) return NewAddRec; in getMulExpr()
2088 Ops[Idx] = NewAddRec; in getMulExpr()
2089 Ops.erase(Ops.begin() + OtherIdx); --OtherIdx; in getMulExpr()
2097 return getMulExpr(Ops); in getMulExpr()
2108 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getMulExpr()
2109 ID.AddPointer(Ops[i]); in getMulExpr()
2114 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getMulExpr()
2115 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getMulExpr()
2117 O, Ops.size()); in getMulExpr()
2375 SmallVector<const SCEV *, 2> Ops; in getSMaxExpr() local
2376 Ops.push_back(LHS); in getSMaxExpr()
2377 Ops.push_back(RHS); in getSMaxExpr()
2378 return getSMaxExpr(Ops); in getSMaxExpr()
2382 ScalarEvolution::getSMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getSMaxExpr() argument
2383 assert(!Ops.empty() && "Cannot get empty smax!"); in getSMaxExpr()
2384 if (Ops.size() == 1) return Ops[0]; in getSMaxExpr()
2386 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getSMaxExpr()
2387 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getSMaxExpr()
2388 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getSMaxExpr()
2393 GroupByComplexity(Ops, LI); in getSMaxExpr()
2397 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getSMaxExpr()
2399 assert(Idx < Ops.size()); in getSMaxExpr()
2400 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getSMaxExpr()
2405 Ops[0] = getConstant(Fold); in getSMaxExpr()
2406 Ops.erase(Ops.begin()+1); // Erase the folded element in getSMaxExpr()
2407 if (Ops.size() == 1) return Ops[0]; in getSMaxExpr()
2408 LHSC = cast<SCEVConstant>(Ops[0]); in getSMaxExpr()
2412 if (cast<SCEVConstant>(Ops[0])->getValue()->isMinValue(true)) { in getSMaxExpr()
2413 Ops.erase(Ops.begin()); in getSMaxExpr()
2415 } else if (cast<SCEVConstant>(Ops[0])->getValue()->isMaxValue(true)) { in getSMaxExpr()
2418 return Ops[0]; in getSMaxExpr()
2421 if (Ops.size() == 1) return Ops[0]; in getSMaxExpr()
2425 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scSMaxExpr) in getSMaxExpr()
2430 if (Idx < Ops.size()) { in getSMaxExpr()
2432 while (const SCEVSMaxExpr *SMax = dyn_cast<SCEVSMaxExpr>(Ops[Idx])) { in getSMaxExpr()
2433 Ops.erase(Ops.begin()+Idx); in getSMaxExpr()
2434 Ops.append(SMax->op_begin(), SMax->op_end()); in getSMaxExpr()
2439 return getSMaxExpr(Ops); in getSMaxExpr()
2445 for (unsigned i = 0, e = Ops.size()-1; i != e; ++i) in getSMaxExpr()
2448 if (Ops[i] == Ops[i+1] || in getSMaxExpr()
2449 isKnownPredicate(ICmpInst::ICMP_SGE, Ops[i], Ops[i+1])) { in getSMaxExpr()
2450 Ops.erase(Ops.begin()+i+1, Ops.begin()+i+2); in getSMaxExpr()
2452 } else if (isKnownPredicate(ICmpInst::ICMP_SLE, Ops[i], Ops[i+1])) { in getSMaxExpr()
2453 Ops.erase(Ops.begin()+i, Ops.begin()+i+1); in getSMaxExpr()
2457 if (Ops.size() == 1) return Ops[0]; in getSMaxExpr()
2459 assert(!Ops.empty() && "Reduced smax down to nothing!"); in getSMaxExpr()
2465 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getSMaxExpr()
2466 ID.AddPointer(Ops[i]); in getSMaxExpr()
2469 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getSMaxExpr()
2470 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getSMaxExpr()
2472 O, Ops.size()); in getSMaxExpr()
2479 SmallVector<const SCEV *, 2> Ops; in getUMaxExpr() local
2480 Ops.push_back(LHS); in getUMaxExpr()
2481 Ops.push_back(RHS); in getUMaxExpr()
2482 return getUMaxExpr(Ops); in getUMaxExpr()
2486 ScalarEvolution::getUMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getUMaxExpr() argument
2487 assert(!Ops.empty() && "Cannot get empty umax!"); in getUMaxExpr()
2488 if (Ops.size() == 1) return Ops[0]; in getUMaxExpr()
2490 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getUMaxExpr()
2491 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getUMaxExpr()
2492 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getUMaxExpr()
2497 GroupByComplexity(Ops, LI); in getUMaxExpr()
2501 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getUMaxExpr()
2503 assert(Idx < Ops.size()); in getUMaxExpr()
2504 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getUMaxExpr()
2509 Ops[0] = getConstant(Fold); in getUMaxExpr()
2510 Ops.erase(Ops.begin()+1); // Erase the folded element in getUMaxExpr()
2511 if (Ops.size() == 1) return Ops[0]; in getUMaxExpr()
2512 LHSC = cast<SCEVConstant>(Ops[0]); in getUMaxExpr()
2516 if (cast<SCEVConstant>(Ops[0])->getValue()->isMinValue(false)) { in getUMaxExpr()
2517 Ops.erase(Ops.begin()); in getUMaxExpr()
2519 } else if (cast<SCEVConstant>(Ops[0])->getValue()->isMaxValue(false)) { in getUMaxExpr()
2522 return Ops[0]; in getUMaxExpr()
2525 if (Ops.size() == 1) return Ops[0]; in getUMaxExpr()
2529 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scUMaxExpr) in getUMaxExpr()
2534 if (Idx < Ops.size()) { in getUMaxExpr()
2536 while (const SCEVUMaxExpr *UMax = dyn_cast<SCEVUMaxExpr>(Ops[Idx])) { in getUMaxExpr()
2537 Ops.erase(Ops.begin()+Idx); in getUMaxExpr()
2538 Ops.append(UMax->op_begin(), UMax->op_end()); in getUMaxExpr()
2543 return getUMaxExpr(Ops); in getUMaxExpr()
2549 for (unsigned i = 0, e = Ops.size()-1; i != e; ++i) in getUMaxExpr()
2552 if (Ops[i] == Ops[i+1] || in getUMaxExpr()
2553 isKnownPredicate(ICmpInst::ICMP_UGE, Ops[i], Ops[i+1])) { in getUMaxExpr()
2554 Ops.erase(Ops.begin()+i+1, Ops.begin()+i+2); in getUMaxExpr()
2556 } else if (isKnownPredicate(ICmpInst::ICMP_ULE, Ops[i], Ops[i+1])) { in getUMaxExpr()
2557 Ops.erase(Ops.begin()+i, Ops.begin()+i+1); in getUMaxExpr()
2561 if (Ops.size() == 1) return Ops[0]; in getUMaxExpr()
2563 assert(!Ops.empty() && "Reduced umax down to nothing!"); in getUMaxExpr()
2569 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getUMaxExpr()
2570 ID.AddPointer(Ops[i]); in getUMaxExpr()
2573 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getUMaxExpr()
2574 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getUMaxExpr()
2576 O, Ops.size()); in getUMaxExpr()
3084 SmallVector<const SCEV *, 8> Ops; in createNodeForPHI() local
3087 Ops.push_back(Add->getOperand(i)); in createNodeForPHI()
3088 const SCEV *Accum = getAddExpr(Ops); in createNodeForPHI()