Home | History | Annotate | Download | only in Scalar

Lines Matching refs:SE

256   void InitialMatch(const SCEV *S, Loop *L, ScalarEvolution &SE);
277 ScalarEvolution &SE) {
279 if (SE.properlyDominates(S, L->getHeader())) {
288 DoInitialMatch(*I, L, Good, Bad, SE);
295 DoInitialMatch(AR->getStart(), L, Good, Bad, SE);
296 DoInitialMatch(SE.getAddRecExpr(SE.getConstant(AR->getType(), 0),
297 AR->getStepRecurrence(SE),
300 L, Good, Bad, SE);
308 const SCEV *NewMul = SE.getMulExpr(Ops);
312 DoInitialMatch(NewMul, L, MyGood, MyBad, SE);
313 const SCEV *NegOne = SE.getSCEV(ConstantInt::getAllOnesValue(
314 SE.getEffectiveSCEVType(NewMul->getType())));
317 Good.push_back(SE.getMulExpr(NegOne, *I));
320 Bad.push_back(SE.getMulExpr(NegOne, *I));
332 void Formula::InitialMatch(const SCEV *S, Loop *L, ScalarEvolution &SE) {
335 DoInitialMatch(S, L, Good, Bad, SE);
337 const SCEV *Sum = SE.getAddExpr(Good);
343 const SCEV *Sum = SE.getAddExpr(Bad);
438 static bool isAddRecSExtable(const SCEVAddRecExpr *AR, ScalarEvolution &SE) {
440 IntegerType::get(SE.getContext(), SE.getTypeSizeInBits(AR->getType()) + 1);
441 return isa<SCEVAddRecExpr>(SE.getSignExtendExpr(AR, WideTy));
446 static bool isAddSExtable(const SCEVAddExpr *A, ScalarEvolution &SE) {
448 IntegerType::get(SE.getContext(), SE.getTypeSizeInBits(A->getType()) + 1);
449 return isa<SCEVAddExpr>(SE.getSignExtendExpr(A, WideTy));
454 static bool isMulSExtable(const SCEVMulExpr *M, ScalarEvolution &SE) {
456 IntegerType::get(SE.getContext(),
457 SE.getTypeSizeInBits(M->getType()) * M->getNumOperands());
458 return isa<SCEVMulExpr>(SE.getSignExtendExpr(M, WideTy));
468 ScalarEvolution &SE,
472 return SE.getConstant(LHS->getType(), 1);
481 return SE.getMulExpr(LHS, RC);
495 return SE.getConstant(LA.sdiv(RA));
500 if (IgnoreSignificantBits || isAddRecSExtable(AR, SE)) {
501 const SCEV *Step = getExactSDiv(AR->getStepRecurrence(SE), RHS, SE,
504 const SCEV *Start = getExactSDiv(AR->getStart(), RHS, SE,
510 return SE.getAddRecExpr(Start, Step, AR->getLoop(), SCEV::FlagAnyWrap);
517 if (IgnoreSignificantBits || isAddSExtable(Add, SE)) {
521 const SCEV *Op = getExactSDiv(*I, RHS, SE,
526 return SE.getAddExpr(Ops);
533 if (IgnoreSignificantBits || isMulSExtable(Mul, SE)) {
540 if (const SCEV *Q = getExactSDiv(S, RHS, SE,
547 return Found ? SE.getMulExpr(Ops) : 0;
559 static int64_t ExtractImmediate(const SCEV *&S, ScalarEvolution &SE) {
562 S = SE.getConstant(C->getType(), 0);
567 int64_t Result = ExtractImmediate(NewOps.front(), SE);
569 S = SE.getAddExpr(NewOps);
573 int64_t Result = ExtractImmediate(NewOps.front(), SE);
575 S = SE.getAddRecExpr(NewOps, AR->getLoop(),
586 static GlobalValue *ExtractSymbol(const SCEV *&S, ScalarEvolution &SE) {
589 S = SE.getConstant(GV->getType(), 0);
594 GlobalValue *Result = ExtractSymbol(NewOps.back(), SE);
596 S = SE.getAddExpr(NewOps);
600 GlobalValue *Result = ExtractSymbol(NewOps.front(), SE);
602 S = SE.getAddRecExpr(NewOps, AR->getLoop(),
664 static bool isExistingPhi(const SCEVAddRecExpr *AR, ScalarEvolution &SE) {
667 if (SE.isSCEVable(PN->getType()) &&
668 (SE.getEffectiveSCEVType(PN->getType()) ==
669 SE.getEffectiveSCEVType(AR->getType())) &&
670 SE.getSCEV(PN) == AR)
687 ScalarEvolution &SE) {
695 Processed, SE);
698 Processed, SE);
701 Processed, SE);
710 if (isHighCostExpansion(*I, Processed, SE))
720 return isHighCostExpansion(Mul->getOperand(1), Processed, SE);
731 && SE.isSCEVable(User->getType())) {
732 return SE.getSCEV(User) == Mul;
740 if (isExistingPhi(AR, SE))
818 ScalarEvolution &SE, DominatorTree &DT,
828 ScalarEvolution &SE, DominatorTree &DT);
832 ScalarEvolution &SE, DominatorTree &DT,
842 ScalarEvolution &SE, DominatorTree &DT) {
850 if (isExistingPhi(AR, SE))
863 RateRegister(AR->getOperand(1), Regs, L, SE, DT);
881 SE.hasComputableLoopEvolution(Reg, L);
890 ScalarEvolution &SE, DominatorTree &DT,
897 RateRegister(Reg, Regs, L, SE, DT);
908 ScalarEvolution &SE, DominatorTree &DT,
916 RatePrimaryRegister(ScaledReg, Regs, L, SE, DT, LoserRegs);
927 RatePrimaryRegister(BaseReg, Regs, L, SE, DT, LoserRegs);
1384 ScalarEvolution &SE, int64_t MinOffset,
1392 int64_t BaseOffset = ExtractImmediate(S, SE);
1393 GlobalValue *BaseGV = ExtractSymbol(S, SE);
1503 ScalarEvolution &SE;
1658 const SCEV *BackedgeTakenCount = SE.getBackedgeTakenCount(L);
1703 if ((int)SE.getTypeSizeInBits(SrcTy) > Mantissa)
1838 const SCEV *BackedgeTakenCount = SE.getBackedgeTakenCount(L);
1841 const SCEV *One = SE.getConstant(BackedgeTakenCount->getType(), 1);
1844 const SCEV *IterationCount = SE.getAddExpr(One, BackedgeTakenCount);
1845 if (IterationCount != SE.getSCEV(Sel)) return Cond;
1882 const SCEV *IV = SE.getSCEV(Cond->getOperand(0));
1886 AR->getStepRecurrence(SE) != One)
1900 SE.getSCEV(BO->getOperand(0)) == MaxRHS)
1905 SE.getSCEV(BO->getOperand(0)) == MaxRHS)
1909 } else if (SE.getSCEV(Sel->getOperand(1)) == MaxRHS)
1911 else if (SE.getSCEV(Sel->getOperand(2)) == MaxRHS)
1998 if (SE.getTypeSizeInBits(A->getType()) !=
1999 SE.getTypeSizeInBits(B->getType())) {
2000 if (SE.getTypeSizeInBits(A->getType()) >
2001 SE.getTypeSizeInBits(B->getType()))
2002 B = SE.getSignExtendExpr(B, A->getType());
2004 A = SE.getSignExtendExpr(A, B->getType());
2007 dyn_cast_or_null<SCEVConstant>(getExactSDiv(B, A, SE))) {
2128 int64_t Offset = ExtractImmediate(Expr, SE);
2227 Types.insert(SE.getEffectiveSCEVType(Expr->getType()));
2235 Strides.insert(AR->getStepRecurrence(SE));
2251 if (SE.getTypeSizeInBits(OldStride->getType()) !=
2252 SE.getTypeSizeInBits(NewStride->getType())) {
2253 if (SE.getTypeSizeInBits(OldStride->getType()) >
2254 SE.getTypeSizeInBits(NewStride->getType()))
2255 NewStride = SE.getSignExtendExpr(NewStride, OldStride->getType());
2257 OldStride = SE.getSignExtendExpr(OldStride, NewStride->getType());
2261 SE, true))) {
2267 SE, true))) {
2286 Loop *L, ScalarEvolution &SE) {
2289 if (!SE.isSCEVable(Oper->getType()))
2293 dyn_cast<SCEVAddRecExpr>(SE.getSCEV(Oper))) {
2368 ScalarEvolution &SE) {
2376 const SCEV *HeadExpr = SE.getSCEV(getWideOperand(Incs[0].IVOperand));
2377 if (isa<SCEVConstant>(SE.getMinusSCEV(OperExpr, HeadExpr)))
2382 return !isHighCostExpansion(IncExpr, Processed, SE);
2397 ScalarEvolution &SE, const TargetTransformInfo &TTI) {
2421 && SE.getSCEV(Chain.tailUserInst()) == Chain.Incs[0].IncExpr) {
2477 const SCEV *const OperExpr = SE.getSCEV(NextIV);
2503 const SCEV *PrevExpr = SE.getSCEV(PrevIV);
2504 const SCEV *IncExpr = SE.getMinusSCEV(OperExpr, PrevExpr);
2505 if (!SE.isLoopInvariant(IncExpr, L))
2508 if (Chain.isProfitableIncrement(OperExpr, IncExpr, SE)) {
2571 if (SE.isSCEVable(OtherUse->getType())
2572 && !isa<SCEVUnknown>(SE.getSCEV(OtherUse))
2631 if (SE.isSCEVable(I->getType()) && !isa<SCEVUnknown>(SE.getSCEV(I)))
2642 User::op_iterator IVOpIter = findIVOperand(I->op_begin(), IVOpEnd, L, SE);
2647 IVOpIter = findIVOperand(llvm::next(IVOpIter), IVOpEnd, L, SE);
2654 if (!SE.isSCEVable(PN->getType()))
2667 SE, TTI))
2720 IVOpEnd, L, SE);
2733 if (SE.getSCEV(*IVOpIter) == Head.IncExpr
2734 || SE.getSCEV(IVSrc) == Head.IncExpr) {
2737 IVOpIter = findIVOperand(llvm::next(IVOpIter), IVOpEnd, L, SE);
2747 Type *IntTy = SE.getEffectiveSCEVType(IVTy);
2762 const SCEV *IncExpr = SE.getNoopOrSignExtend(IncI->IncExpr, IntTy);
2764 SE.getAddExpr(LeftOverExpr, IncExpr) : IncExpr;
2770 const SCEV *IVOperExpr = SE.getAddExpr(SE.getUnknown(IVSrc),
2771 SE.getUnknown(IncV));
2784 assert(SE.getTypeSizeInBits(IVTy) >= SE.getTypeSizeInBits(OperTy) &&
2801 if (!PostIncV || (SE.getSCEV(PostIncV) != SE.getSCEV(IVSrc)))
2861 const SCEV *N = SE.getSCEV(NV);
2862 if (SE.isLoopInvariant(N, L) && isSafeToExpand(N)) {
2866 LF.PostIncLoops, SE, DT);
2868 S = SE.getMinusSCEV(N, S);
2886 SE.getTypeSizeInBits(LU.WidestFixupType) <
2887 SE.getTypeSizeInBits(LF.OperandValToReplace->getType()))
2906 F.InitialMatch(S, L, SE);
2991 if (SE.isSCEVable(UserInst->getType())) {
2992 const SCEV *UserS = SE.getSCEV(const_cast<Instruction *>(UserInst));
2998 SE.getUnknown(const_cast<Instruction *>(UserInst)));
3006 if (SE.hasComputableLoopEvolution(SE.getSCEV(OtherOp), L))
3019 SE.getTypeSizeInBits(LU.WidestFixupType) <
3020 SE.getTypeSizeInBits(LF.OperandValToReplace->getType()))
3038 ScalarEvolution &SE,
3048 const SCEV *Remainder = CollectSubexprs(*I, C, Ops, L, SE, Depth+1);
3050 Ops.push_back(C ? SE.getMulExpr(C, Remainder) : Remainder);
3059 C, Ops, L, SE, Depth+1);
3063 Ops.push_back(C ? SE
3068 Remainder = SE.getConstant(AR->getType(), 0);
3069 return SE.getAddRecExpr(Remainder,
3070 AR->getStepRecurrence(SE),
3081 C = C ? cast<SCEVConstant>(SE.getMulExpr(C, Op0)) : Op0;
3083 CollectSubexprs(Mul->getOperand(1), C, Ops, L, SE, Depth+1);
3085 Ops.push_back(SE.getMulExpr(C, Remainder));
3104 const SCEV *Remainder = CollectSubexprs(BaseReg, 0, AddOps, L, SE);
3115 if (isa<SCEVUnknown>(*J) && !SE.isLoopInvariant(*J, L))
3120 if (isAlwaysFoldable(TTI, SE, LU.MinOffset, LU.MaxOffset, LU.Kind,
3133 isAlwaysFoldable(TTI, SE, LU.MinOffset, LU.MaxOffset, LU.Kind,
3137 const SCEV *InnerSum = SE.getAddExpr(InnerAddOps);
3145 SE.getTypeSizeInBits(InnerSumSC->getType()) <= 64 &&
3156 if (SC && SE.getTypeSizeInBits(SC->getType()) <= 64 &&
3185 if (SE.properlyDominates(BaseReg, L->getHeader()) &&
3186 !SE.hasComputableLoopEvolution(BaseReg, L))
3192 const SCEV *Sum = SE.getAddExpr(Ops);
3211 GlobalValue *GV = ExtractSymbol(G, SE);
3243 const SCEV *NewG = SE.getAddExpr(SE.getConstant(G->getType(), *I), G);
3255 int64_t Imm = ExtractImmediate(G, SE);
3276 if (SE.getTypeSizeInBits(IntTy) > 64) return;
3313 const SCEV *FactorS = SE.getConstant(IntTy, Factor);
3317 F.BaseRegs[i] = SE.getMulExpr(F.BaseRegs[i], FactorS);
3318 if (getExactSDiv(F.BaseRegs[i], FactorS, SE) != Base.BaseRegs[i])
3324 F.ScaledReg = SE.getMulExpr(F.ScaledReg, FactorS);
3325 if (getExactSDiv(F.ScaledReg, FactorS, SE) != Base.ScaledReg)
3383 const SCEV *FactorS = SE.getConstant(IntTy, Factor);
3388 if (const SCEV *Quotient = getExactSDiv(AR, FactorS, SE, true)) {
3407 DstTy = SE.getEffectiveSCEVType(DstTy);
3415 if (F.ScaledReg) F.ScaledReg = SE.getAnyExtendExpr(F.ScaledReg, *I);
3418 *J = SE.getAnyExtendExpr(*J, SrcTy);
3472 int64_t Imm = ExtractImmediate(Reg, SE);
3550 Type *IntTy = SE.getEffectiveSCEVType(OrigReg->getType());
3551 const SCEV *NegImmS = SE.getSCEV(ConstantInt::get(IntTy, -(uint64_t)Imm));
3552 unsigned BitWidth = SE.getTypeSizeInBits(IntTy);
3561 if (F.referencesReg(SE.getSCEV(
3569 NewF.ScaledReg = SE.getAddExpr(NegImmS, NewF.ScaledReg);
3598 NewF.BaseRegs[N] = SE.getAddExpr(NegImmS, BaseReg);
3694 CostF.RateFormula(F, Regs, VisitedRegs, L, LU.Offsets, SE, DT,
3730 CostBest.RateFormula(Best, Regs, VisitedRegs, L, LU.Offsets, SE, DT);
4083 NewCost.RateFormula(F, NewRegs, VisitedRegs, L, LU.Offsets, SE, DT);
4286 else if (SE.getEffectiveSCEVType(Ty) == SE.getEffectiveSCEVType(OpTy))
4290 Type *IntTy = SE.getEffectiveSCEVType(Ty);
4305 Loops, SE, DT);
4307 Ops.push_back(SE.getUnknown(Rewriter.expandCodeFor(Reg, 0, IP)));
4319 Loops, SE, DT);
4334 Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP);
4336 Ops.push_back(SE.getUnknown(FullV));
4338 ScaledS = SE.getUnknown(Rewriter.expandCodeFor(ScaledS, 0, IP));
4339 ScaledS = SE.getMulExpr(ScaledS,
4340 SE.getConstant(ScaledS->getType(), F.Scale));
4349 Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP);
4351 Ops.push_back(SE.getUnknown(FullV));
4353 Ops.push_back(SE
4359 Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP);
4361 Ops.push_back(SE.getUnknown(FullV));
4373 Ops.push_back(SE.getUnknown(ICmpScaledV));
4379 Ops.push_back(SE.getUnknown(ConstantInt::getSigned(IntTy, Offset)));
4387 Ops.push_back(SE.getUnknown(ConstantInt::getSigned(IntTy,
4393 SE.getConstant(IntTy, 0) :
4394 SE.getAddExpr(Ops);
4421 Constant *C = ConstantInt::getSigned(SE.getEffectiveSCEVType(OpTy),
4556 SCEVExpander Rewriter(SE, "lsr");
4594 : IU(P->getAnalysis<IVUsers>()), SE(P->getAnalysis<ScalarEvolution>()),