Lines Matching refs:SE
92 SE.DT.dominates(cast<Instruction>(Ret), &*BIP)); in ReuseOrCreateCast()
161 assert(SE.getTypeSizeInBits(V->getType()) == SE.getTypeSizeInBits(Ty) && in InsertNoopCastOfTo()
191 SE.getTypeSizeInBits(Ty) == SE.getTypeSizeInBits(V->getType())) { in InsertNoopCastOfTo()
195 SE.getTypeSizeInBits(CI->getType()) == in InsertNoopCastOfTo()
196 SE.getTypeSizeInBits(CI->getOperand(0)->getType())) in InsertNoopCastOfTo()
201 SE.getTypeSizeInBits(CE->getType()) == in InsertNoopCastOfTo()
202 SE.getTypeSizeInBits(CE->getOperand(0)->getType())) in InsertNoopCastOfTo()
266 while (const Loop *L = SE.LI.getLoopFor(Builder.GetInsertBlock())) { in InsertBinop()
294 const SCEV *Factor, ScalarEvolution &SE, in FactorOutConstant() argument
302 S = SE.getConstant(S->getType(), 1); in FactorOutConstant()
314 ConstantInt::get(SE.getContext(), C->getAPInt().sdiv(FC->getAPInt())); in FactorOutConstant()
319 const SCEV *Div = SE.getConstant(CI); in FactorOutConstant()
321 Remainder = SE.getAddExpr( in FactorOutConstant()
322 Remainder, SE.getConstant(C->getAPInt().srem(FC->getAPInt()))); in FactorOutConstant()
337 NewMulOps[0] = SE.getConstant(C->getAPInt().sdiv(FC->getAPInt())); in FactorOutConstant()
338 S = SE.getMulExpr(NewMulOps); in FactorOutConstant()
345 const SCEV *Step = A->getStepRecurrence(SE); in FactorOutConstant()
346 const SCEV *StepRem = SE.getConstant(Step->getType(), 0); in FactorOutConstant()
347 if (!FactorOutConstant(Step, StepRem, Factor, SE, DL)) in FactorOutConstant()
352 if (!FactorOutConstant(Start, Remainder, Factor, SE, DL)) in FactorOutConstant()
354 S = SE.getAddRecExpr(Start, Step, A->getLoop(), in FactorOutConstant()
368 ScalarEvolution &SE) { in SimplifyAddOperands() argument
377 SE.getConstant(Ty, 0) : in SimplifyAddOperands()
378 SE.getAddExpr(NoAddRecs); in SimplifyAddOperands()
397 ScalarEvolution &SE) { in SplitAddRecs() argument
404 const SCEV *Zero = SE.getConstant(Ty, 0); in SplitAddRecs()
405 AddRecs.push_back(SE.getAddRecExpr(Zero, in SplitAddRecs()
406 A->getStepRecurrence(SE), in SplitAddRecs()
421 SimplifyAddOperands(Ops, Ty, SE); in SplitAddRecs()
463 SplitAddRecs(Ops, Ty, SE); in expandAddToGEP()
480 const SCEV *ElSize = SE.getSizeOfExpr(IntIdxTy, ElTy); in expandAddToGEP()
484 const SCEV *Remainder = SE.getConstant(Ty, 0); in expandAddToGEP()
485 if (FactorOutConstant(Op, Remainder, ElSize, SE, DL)) { in expandAddToGEP()
500 SimplifyAddOperands(Ops, Ty, SE); in expandAddToGEP()
512 : expandCodeForImpl(SE.getAddExpr(ScaledOps), Ty, false); in expandAddToGEP()
525 if (SE.getTypeSizeInBits(C->getType()) <= 64) { in expandAddToGEP()
534 SE.getConstant(Ty, FullOffset - SL.getElementOffset(ElIdx)); in expandAddToGEP()
570 SE.DT.dominates(cast<Instruction>(V), &*Builder.GetInsertPoint())); in expandAddToGEP()
573 Value *Idx = expandCodeForImpl(SE.getAddExpr(Ops), Ty, false); in expandAddToGEP()
606 while (const Loop *L = SE.LI.getLoopFor(Builder.GetInsertBlock())) { in expandAddToGEP()
623 while (const Loop *L = SE.LI.getLoopFor(Builder.GetInsertBlock())) { in expandAddToGEP()
647 Ops.push_back(SE.getUnknown(GEP)); in expandAddToGEP()
650 return expand(SE.getAddExpr(Ops)); in expandAddToGEP()
686 return Pair.first->second = SE.LI.getLoopFor(I->getParent()); in getRelevantLoop()
695 L = PickMostRelevantLoop(L, getRelevantLoop(Op), SE.DT); in getRelevantLoop()
704 getRelevantLoop(D->getLHS()), getRelevantLoop(D->getRHS()), SE.DT); in getRelevantLoop()
746 Type *Ty = SE.getEffectiveSCEVType(S->getType()); in visitAddExpr()
758 llvm::stable_sort(OpsAndLoops, LoopCompare(SE.DT)); in visitAddExpr()
784 X = SE.getSCEV(U->getValue()); in visitAddExpr()
790 Value *W = expandCodeForImpl(SE.getNegativeSCEV(Op), Ty, false); in visitAddExpr()
811 Type *Ty = SE.getEffectiveSCEVType(S->getType()); in visitMulExpr()
820 llvm::stable_sort(OpsAndLoops, LoopCompare(SE.DT)); in visitMulExpr()
905 Type *Ty = SE.getEffectiveSCEVType(S->getType()); in visitUDivExpr()
918 /*IsSafeToHoist*/ SE.isKnownNonZero(S->getRHS())); in visitUDivExpr()
934 if (!SE.DT.dominates(OInst, IVIncInsertPos)) in isNormalAddRecExprPHI()
973 if (!OInst || SE.DT.dominates(OInst, InsertPos)) in getIVIncOperand()
984 if (!SE.DT.dominates(OInst, InsertPos)) in getIVIncOperand()
998 if (IncV->getType() != Type::getInt1PtrTy(SE.getContext(), AS) in getIVIncOperand()
999 && IncV->getType() != Type::getInt8PtrTy(SE.getContext(), AS)) in getIVIncOperand()
1028 if (SE.DT.dominates(IncV, InsertPos)) in hoistIVInc()
1034 !SE.DT.dominates(InsertPos->getParent(), IncV->getParent())) in hoistIVInc()
1037 if (!SE.LI.movementPreservesLCSSAForm(IncV, InsertPos)) in hoistIVInc()
1049 if (SE.DT.dominates(IncV, InsertPos)) in hoistIVInc()
1088 GEPPtrTy = PointerType::get(Type::getInt1Ty(SE.getContext()), in expandIVInc()
1090 IncV = expandAddToGEP(SE.getSCEV(StepV), GEPPtrTy, IntTy, PN); in expandIVInc()
1103 static bool canBeCheaplyTransformed(ScalarEvolution &SE, in canBeCheaplyTransformed() argument
1111 Type *PhiTy = SE.getEffectiveSCEVType(Phi->getType()); in canBeCheaplyTransformed()
1112 Type *RequestedTy = SE.getEffectiveSCEVType(Requested->getType()); in canBeCheaplyTransformed()
1118 Phi = dyn_cast<SCEVAddRecExpr>(SE.getTruncateOrNoop(Phi, RequestedTy)); in canBeCheaplyTransformed()
1129 if (SE.getMinusSCEV(Requested->getStart(), Requested) == Phi) { in canBeCheaplyTransformed()
1137 static bool IsIncrementNSW(ScalarEvolution &SE, const SCEVAddRecExpr *AR) { in IsIncrementNSW() argument
1143 const SCEV *Step = AR->getStepRecurrence(SE); in IsIncrementNSW()
1144 const SCEV *OpAfterExtend = SE.getAddExpr(SE.getSignExtendExpr(Step, WideTy), in IsIncrementNSW()
1145 SE.getSignExtendExpr(AR, WideTy)); in IsIncrementNSW()
1147 SE.getSignExtendExpr(SE.getAddExpr(AR, Step), WideTy); in IsIncrementNSW()
1151 static bool IsIncrementNUW(ScalarEvolution &SE, const SCEVAddRecExpr *AR) { in IsIncrementNUW() argument
1157 const SCEV *Step = AR->getStepRecurrence(SE); in IsIncrementNUW()
1158 const SCEV *OpAfterExtend = SE.getAddExpr(SE.getZeroExtendExpr(Step, WideTy), in IsIncrementNUW()
1159 SE.getZeroExtendExpr(AR, WideTy)); in IsIncrementNUW()
1161 SE.getZeroExtendExpr(SE.getAddExpr(AR, Step), WideTy); in IsIncrementNUW()
1189 SE.DT.properlyDominates(LatchBlock, IVIncInsertLoop->getHeader()); in getAddRecExprPHILiterally()
1192 if (!SE.isSCEVable(PN.getType())) in getAddRecExprPHILiterally()
1203 const SCEVAddRecExpr *PhiSCEV = dyn_cast<SCEVAddRecExpr>(SE.getSCEV(&PN)); in getAddRecExprPHILiterally()
1241 canBeCheaplyTransformed(SE, PhiSCEV, Normalized, InvertStep)) { in getAddRecExprPHILiterally()
1246 TruncTy = SE.getEffectiveSCEVType(Normalized->getType()); in getAddRecExprPHILiterally()
1286 SE.DT.properlyDominates(cast<Instruction>(StartV)->getParent(), in getAddRecExprPHILiterally()
1291 const SCEV *Step = Normalized->getStepRecurrence(SE); in getAddRecExprPHILiterally()
1297 Step = SE.getNegativeSCEV(Step); in getAddRecExprPHILiterally()
1305 bool IncrementIsNUW = !useSubtract && IsIncrementNUW(SE, Normalized); in getAddRecExprPHILiterally()
1306 bool IncrementIsNSW = !useSubtract && IsIncrementNSW(SE, Normalized); in getAddRecExprPHILiterally()
1355 Type *IntTy = SE.getEffectiveSCEVType(STy); in expandAddRecExprLiterally()
1364 Normalized = cast<SCEVAddRecExpr>(normalizeForPostIncUse(S, Loops, SE)); in expandAddRecExprLiterally()
1370 if (!SE.properlyDominates(Start, L->getHeader())) { in expandAddRecExprLiterally()
1372 Start = SE.getConstant(Normalized->getType(), 0); in expandAddRecExprLiterally()
1374 SE.getAddRecExpr(Start, Normalized->getStepRecurrence(SE), in expandAddRecExprLiterally()
1380 const SCEV *Step = Normalized->getStepRecurrence(SE); in expandAddRecExprLiterally()
1382 if (!SE.dominates(Step, L->getHeader())) { in expandAddRecExprLiterally()
1384 Step = SE.getConstant(Normalized->getType(), 1); in expandAddRecExprLiterally()
1390 Start = SE.getConstant(Normalized->getType(), 0); in expandAddRecExprLiterally()
1393 cast<SCEVAddRecExpr>(SE.getAddRecExpr( in expandAddRecExprLiterally()
1438 !SE.DT.dominates(cast<Instruction>(Result), in expandAddRecExprLiterally()
1452 Step = SE.getNegativeSCEV(Step); in expandAddRecExprLiterally()
1469 if (ResTy != SE.getEffectiveSCEVType(ResTy)) in expandAddRecExprLiterally()
1470 Result = InsertNoopCastOfTo(Result, SE.getEffectiveSCEVType(ResTy)); in expandAddRecExprLiterally()
1494 Result = expandAddToGEP(SE.getUnknown(Result), PTy, IntTy, Base); in expandAddRecExprLiterally()
1522 Type *Ty = SE.getEffectiveSCEVType(S->getType()); in visitAddRecExpr()
1528 if (SE.getTypeSizeInBits(PN->getType()) >= SE.getTypeSizeInBits(Ty)) in visitAddRecExpr()
1534 SE.getTypeSizeInBits(CanonicalIV->getType()) > SE.getTypeSizeInBits(Ty) && in visitAddRecExpr()
1538 NewOps[i] = SE.getAnyExtendExpr(S->op_begin()[i], CanonicalIV->getType()); in visitAddRecExpr()
1539 Value *V = expand(SE.getAddRecExpr(NewOps, S->getLoop(), in visitAddRecExpr()
1543 V = expandCodeForImpl(SE.getTruncateExpr(SE.getUnknown(V), Ty), nullptr, in visitAddRecExpr()
1551 Value *StartV = expand(SE.getPointerBase(S)); in visitAddRecExpr()
1553 return expandAddToGEP(SE.removePointerBase(S), PTy, Ty, StartV); in visitAddRecExpr()
1557 NewOps[0] = SE.getConstant(Ty, 0); in visitAddRecExpr()
1558 const SCEV *Rest = SE.getAddRecExpr(NewOps, L, in visitAddRecExpr()
1565 const SCEV *AddExprLHS = SE.getUnknown(expand(S->getStart())); in visitAddRecExpr()
1566 const SCEV *AddExprRHS = SE.getUnknown(expand(Rest)); in visitAddRecExpr()
1567 return expand(SE.getAddExpr(AddExprLHS, AddExprRHS)); in visitAddRecExpr()
1608 assert(Ty == SE.getEffectiveSCEVType(CanonicalIV->getType()) && in visitAddRecExpr()
1619 expand(SE.getTruncateOrNoop( in visitAddRecExpr()
1620 SE.getMulExpr(SE.getUnknown(CanonicalIV), in visitAddRecExpr()
1621 SE.getNoopOrAnyExtend(S->getOperand(1), in visitAddRecExpr()
1629 const SCEV *IH = SE.getUnknown(CanonicalIV); // Get I as a "symbolic" SCEV. in visitAddRecExpr()
1633 const SCEV *Ext = SE.getNoopOrAnyExtend(S, CanonicalIV->getType()); in visitAddRecExpr()
1637 const SCEV *V = cast<SCEVAddRecExpr>(NewS)->evaluateAtIteration(IH, SE); in visitAddRecExpr()
1640 const SCEV *T = SE.getTruncateOrNoop(V, Ty); in visitAddRecExpr()
1652 Type *Ty = SE.getEffectiveSCEVType(S->getType()); in visitTruncateExpr()
1654 S->getOperand(), SE.getEffectiveSCEVType(S->getOperand()->getType()), in visitTruncateExpr()
1660 Type *Ty = SE.getEffectiveSCEVType(S->getType()); in visitZeroExtendExpr()
1662 S->getOperand(), SE.getEffectiveSCEVType(S->getOperand()->getType()), in visitZeroExtendExpr()
1668 Type *Ty = SE.getEffectiveSCEVType(S->getType()); in visitSignExtendExpr()
1670 S->getOperand(), SE.getEffectiveSCEVType(S->getOperand()->getType()), in visitSignExtendExpr()
1760 assert(SE.getTypeSizeInBits(Ty) == SE.getTypeSizeInBits(SH->getType()) && in expandCodeForImpl()
1771 if (!CanonicalMode && SE.containsAddRecurrence(S)) in FindValueInExprValueMap()
1781 for (Value *V : SE.getSCEVValues(S)) { in FindValueInExprValueMap()
1788 SE.DT.dominates(EntInst, InsertPt) && in FindValueInExprValueMap()
1789 (SE.LI.getLoopFor(EntInst->getParent()) == nullptr || in FindValueInExprValueMap()
1790 SE.LI.getLoopFor(EntInst->getParent())->contains(InsertPt))) in FindValueInExprValueMap()
1825 for (Loop *L = SE.LI.getLoopFor(Builder.GetInsertBlock());; in expand()
1827 if (SE.isLoopInvariant(S, L)) { in expand()
1840 if (L && SE.hasComputableLoopEvolution(S, L) && !PostIncLoops.count(L)) in expand()
1938 if (Value *V = simplifyInstruction(PN, {DL, &SE.TLI, &SE.DT, &SE.AC})) in replaceCongruentIVs()
1940 if (!SE.isSCEVable(PN->getType())) in replaceCongruentIVs()
1942 auto *Const = dyn_cast<SCEVConstant>(SE.getSCEV(PN)); in replaceCongruentIVs()
1962 if (!SE.isSCEVable(Phi->getType())) in replaceCongruentIVs()
1965 PHINode *&OrigPhiRef = ExprToIVMap[SE.getSCEV(Phi)]; in replaceCongruentIVs()
1973 SE.getTruncateExpr(SE.getSCEV(Phi), Phis.back()->getType()); in replaceCongruentIVs()
2010 SE.getTruncateOrNoop(SE.getSCEV(OrigInc), IsomorphicInc->getType()); in replaceCongruentIVs()
2012 TruncExpr == SE.getSCEV(IsomorphicInc) && in replaceCongruentIVs()
2013 SE.LI.replacementPreservesLCSSAForm(IsomorphicInc, OrigInc) && in replaceCongruentIVs()
2072 if (SE.getSCEV(LHS) == S && SE.DT.dominates(LHS, At)) in getRelatedExistingExpansion()
2075 if (SE.getSCEV(RHS) == S && SE.DT.dominates(RHS, At)) in getRelatedExistingExpansion()
2302 SE.getAddExpr(S, SE.getConstant(S->getType(), 1)), &At, L)) in isHighCostExpansionHelper()
2372 SE.getPredicatedBackedgeTakenCount(AR->getLoop(), Pred); in generateOverflowCheck()
2376 const SCEV *Step = AR->getStepRecurrence(SE); in generateOverflowCheck()
2380 unsigned SrcBits = SE.getTypeSizeInBits(ExitCount->getType()); in generateOverflowCheck()
2381 unsigned DstBits = SE.getTypeSizeInBits(ARTy); in generateOverflowCheck()
2393 IntegerType::get(Loc->getContext(), SE.getTypeSizeInBits(ARTy)); in generateOverflowCheck()
2397 expandCodeForImpl(SE.getNegativeSCEV(Step), Ty, Loc, false); in generateOverflowCheck()
2418 if (!Signed && Start->isZero() && SE.isKnownPositive(Step)) in generateOverflowCheck()
2441 bool NeedPosCheck = !SE.isKnownNegative(Step); in generateOverflowCheck()
2442 bool NeedNegCheck = !SE.isKnownPositive(Step); in generateOverflowCheck()
2479 if (SE.getTypeSizeInBits(CountTy) > SE.getTypeSizeInBits(Ty)) { in generateOverflowCheck()
2541 Loop *DefLoop = SE.LI.getLoopFor(OpI->getParent()); in fixupLCSSAFormFor()
2542 Loop *UseLoop = SE.LI.getLoopFor(User->getParent()); in fixupLCSSAFormFor()
2548 formLCSSAForInstructions(ToUpdate, SE.DT, SE.LI, &SE, Builder, &PHIsToRemove); in fixupLCSSAFormFor()
2580 ScalarEvolution &SE; member
2584 SCEVFindUnsafe(ScalarEvolution &SE, bool CanonicalMode) in SCEVFindUnsafe()
2585 : SE(SE), CanonicalMode(CanonicalMode) {} in SCEVFindUnsafe()
2589 if (!SE.isKnownNonZero(D->getRHS())) { in follow()
2595 const SCEV *Step = AR->getStepRecurrence(SE); in follow()
2596 if (!AR->isAffine() && !SE.dominates(Step, AR->getLoop()->getHeader())) { in follow()
2616 SCEVFindUnsafe Search(SE, CanonicalMode); in isSafeToExpand()
2631 if (SE.properlyDominates(S, InsertionPoint->getParent())) in isSafeToExpandAt()
2633 if (SE.dominates(S, InsertionPoint->getParent())) { in isSafeToExpandAt()