Lines Matching refs:SE
54 function_ref<void(Function &F, LoopInfo &LI, ScalarEvolution &SE)> Test) { in runWithSE()
57 ScalarEvolution SE = buildSE(*F); in runWithSE() local
58 Test(*F, *LI, SE); in runWithSE()
61 static Optional<APInt> computeConstantDifference(ScalarEvolution &SE, in computeConstantDifference() argument
64 return SE.computeConstantDifference(LHS, RHS); in computeConstantDifference()
67 static bool matchURem(ScalarEvolution &SE, const SCEV *Expr, const SCEV *&LHS, in matchURem() argument
69 return SE.matchURem(Expr, LHS, RHS); in matchURem()
73 ScalarEvolution &SE, ICmpInst::Predicate Pred, const SCEV *LHS, in isImpliedCond() argument
76 return SE.isImpliedCond(Pred, LHS, RHS, FoundPred, FoundLHS, FoundRHS); in isImpliedCond()
93 ScalarEvolution SE = buildSE(*F); in TEST_F() local
95 const SCEV *S0 = SE.getSCEV(V0); in TEST_F()
96 const SCEV *S1 = SE.getSCEV(V1); in TEST_F()
97 const SCEV *S2 = SE.getSCEV(V2); in TEST_F()
99 const SCEV *P0 = SE.getAddExpr(S0, SE.getConstant(S0->getType(), 2)); in TEST_F()
100 const SCEV *P1 = SE.getAddExpr(S1, SE.getConstant(S0->getType(), 2)); in TEST_F()
101 const SCEV *P2 = SE.getAddExpr(S2, SE.getConstant(S0->getType(), 2)); in TEST_F()
144 ScalarEvolution SE = buildSE(*F); in TEST_F() local
145 auto *S1 = SE.getSCEV(PN); in TEST_F()
146 auto *S2 = SE.getSCEV(PN); in TEST_F()
147 auto *ZeroConst = SE.getConstant(Ty, 0); in TEST_F()
238 runWithSE(*M, "f_1", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
242 auto *FirstExprForIV0 = SE.getSCEV(IV0); in TEST_F()
243 auto *FirstExprForIV0Inc = SE.getSCEV(IV0Inc); in TEST_F()
244 auto *SecondExprForIV0 = SE.getSCEV(IV0); in TEST_F()
251 auto CheckCommutativeMulExprs = [&](ScalarEvolution &SE, const SCEV *A, in TEST_F()
253 EXPECT_EQ(SE.getMulExpr(A, B), SE.getMulExpr(B, A)); in TEST_F()
254 EXPECT_EQ(SE.getMulExpr(B, C), SE.getMulExpr(C, B)); in TEST_F()
255 EXPECT_EQ(SE.getMulExpr(A, C), SE.getMulExpr(C, A)); in TEST_F()
264 auto *Mul0 = SE.getMulExpr(Ops0); in TEST_F()
265 auto *Mul1 = SE.getMulExpr(Ops1); in TEST_F()
266 auto *Mul2 = SE.getMulExpr(Ops2); in TEST_F()
267 auto *Mul3 = SE.getMulExpr(Ops3); in TEST_F()
268 auto *Mul4 = SE.getMulExpr(Ops4); in TEST_F()
269 auto *Mul5 = SE.getMulExpr(Ops5); in TEST_F()
280 *M, FuncName, [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
281 CheckCommutativeMulExprs(SE, SE.getSCEV(getInstructionByName(F, "x")), in TEST_F()
282 SE.getSCEV(getInstructionByName(F, "y")), in TEST_F()
283 SE.getSCEV(getInstructionByName(F, "z"))); in TEST_F()
349 ScalarEvolution SE = buildSE(*F); in TEST_F() local
351 EXPECT_NE(nullptr, SE.getSCEV(Acc[0])); in TEST_F()
386 ScalarEvolution SE = buildSE(*F); in TEST_F() local
387 auto *A = SE.getSCEV(MulA); in TEST_F()
388 auto *B = SE.getSCEV(MulB); in TEST_F()
420 ScalarEvolution SE = buildSE(*F); in TEST_F() local
421 EXPECT_NE(nullptr, SE.getSCEV(Mul1)); in TEST_F()
428 auto *AddWithNUW = cast<SCEVAddExpr>(SE.getAddExpr( in TEST_F()
429 SE.getAddExpr(SE.getSCEV(A2), SE.getSCEV(A3), SCEV::FlagNUW), in TEST_F()
430 SE.getConstant(APInt(/*numBits=*/32, 5)), SCEV::FlagNUW)); in TEST_F()
435 SE.getAddExpr(SE.getSCEV(A3), SE.getSCEV(A4), SCEV::FlagAnyWrap); in TEST_F()
437 SE.getAddExpr(AddWithAnyWrap, SE.getSCEV(A5), SCEV::FlagNUW)); in TEST_F()
441 auto *AddWithNSW = SE.getAddExpr( in TEST_F()
442 SE.getSCEV(A2), SE.getConstant(APInt(32, 99)), SCEV::FlagNSW); in TEST_F()
444 SE.getAddExpr(AddWithNSW, SE.getSCEV(A5), SCEV::FlagNUW)); in TEST_F()
449 SE.getAddExpr(SE.getSCEV(A2), SE.getSCEV(A4), in TEST_F()
452 SE.getAddExpr(AddWithNSWNUW, SE.getSCEV(A5), SCEV::FlagNUW)); in TEST_F()
457 SE.getAddExpr(AddWithNSW, SE.getSCEV(A6), in TEST_F()
525 runWithSE(*M, "f_1", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
529 auto *S0 = cast<SCEVAddRecExpr>(SE.getSCEV(&I0)); in TEST_F()
532 auto *N0 = normalizeForPostIncUse(S0, Loops, SE); in TEST_F()
533 auto *D0 = denormalizeForPostIncUse(N0, Loops, SE); in TEST_F()
536 auto *S1 = cast<SCEVAddRecExpr>(SE.getSCEV(&I1)); in TEST_F()
539 auto *N1 = normalizeForPostIncUse(S1, Loops, SE); in TEST_F()
540 auto *D1 = denormalizeForPostIncUse(N1, Loops, SE); in TEST_F()
544 runWithSE(*M, "f_2", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
549 auto GetAddRec = [&SE](const Loop *L, std::initializer_list<const SCEV *> Ops) { in TEST_F()
551 return SE.getAddRecExpr(OpsCopy, L, SCEV::FlagAnyWrap); in TEST_F()
554 auto GetAdd = [&SE](std::initializer_list<const SCEV *> Ops) { in TEST_F()
556 return SE.getAddExpr(OpsCopy, SCEV::FlagAnyWrap); in TEST_F()
565 const SCEV *V0 = SE.getSCEV(&*F.arg_begin()); in TEST_F()
566 const SCEV *V1 = SE.getSCEV(&*std::next(F.arg_begin(), 1)); in TEST_F()
567 const SCEV *V2 = SE.getSCEV(&*std::next(F.arg_begin(), 2)); in TEST_F()
568 const SCEV *V3 = SE.getSCEV(&*std::next(F.arg_begin(), 3)); in TEST_F()
605 auto *N = llvm::normalizeForPostIncUse(S, LoopSet, SE); in TEST_F()
606 auto *D = llvm::denormalizeForPostIncUse(N, LoopSet, SE); in TEST_F()
613 auto *D = llvm::denormalizeForPostIncUse(S, LoopSet, SE); in TEST_F()
614 auto *N = llvm::normalizeForPostIncUse(D, LoopSet, SE); in TEST_F()
708 ScalarEvolution SE = buildSE(*F); in TEST_F() local
709 const SCEV *S = SE.getSCEV(Accum); in TEST_F()
710 S = SE.getLosslessPtrToIntExpr(S); in TEST_F()
712 SE.getZeroExtendExpr(S, I128Ty); in TEST_F()
775 ScalarEvolution SE = buildSE(*F); in TEST_F() local
777 const SCEV *EC = SE.getBackedgeTakenCount(Loop); in TEST_F()
784 auto *Five = SE.getConstant(APInt(/*numBits=*/64, 5)); in TEST_F()
786 SE.getAddRecExpr(Five, SE.getOne(T_int64), Loop, SCEV::FlagAnyWrap); in TEST_F()
787 const SCEV *ARAtLoopExit = SE.getSCEVAtScope(AR, nullptr); in TEST_F()
793 SE.forgetLoop(Loop); in TEST_F()
801 const SCEV *NewEC = SE.getBackedgeTakenCount(Loop); in TEST_F()
805 const SCEV *NewARAtLoopExit = SE.getSCEVAtScope(AR, nullptr); in TEST_F()
875 ScalarEvolution SE = buildSE(*F); in TEST_F() local
877 const SCEV *EC = SE.getBackedgeTakenCount(Loop); in TEST_F()
881 SE.forgetValue(Load); in TEST_F()
890 const SCEV *NewEC = SE.getBackedgeTakenCount(Loop); in TEST_F()
944 ScalarEvolution SE = buildSE(*F); in TEST_F() local
945 const SCEV *Expr = SE.getSCEV(Phi); in TEST_F()
948 auto Result = SE.createAddRecFromPHIWithCasts(cast<SCEVUnknown>(Expr)); in TEST_F()
1001 ScalarEvolution SE = buildSE(*F); in TEST_F() local
1002 const SCEV *Expr = SE.getSCEV(Phi); in TEST_F()
1005 auto Result = SE.createAddRecFromPHIWithCasts(cast<SCEVUnknown>(Expr)); in TEST_F()
1020 ScalarEvolution SE = buildSE(*F); in TEST_F() local
1023 const auto *ArgSCEV = SE.getSCEV(Arg); in TEST_F()
1026 const auto *A0 = SE.getNegativeSCEV(ArgSCEV); in TEST_F()
1027 const auto *A1 = SE.getTruncateExpr(A0, Int32Ty); in TEST_F()
1028 const auto *A = SE.getNegativeSCEV(A1); in TEST_F()
1030 const auto *B0 = SE.getTruncateExpr(ArgSCEV, Int32Ty); in TEST_F()
1031 const auto *B = SE.getNegativeSCEV(B0); in TEST_F()
1033 const auto *Expr = SE.getAddExpr(A, B); in TEST_F()
1035 const auto *ZeroConst = SE.getConstant(Int32Ty, 0); in TEST_F()
1075 ScalarEvolution SE = buildSE(*F); in TEST_F() local
1077 const SCEV *AS = SE.getSCEV(A); in TEST_F()
1078 const SCEV *BS = SE.getSCEV(B); in TEST_F()
1079 const SCEV *CS = SE.getSCEV(C); in TEST_F()
1080 const SCEV *S1S = SE.getSCEV(S1); in TEST_F()
1081 const SCEV *S2S = SE.getSCEV(S2); in TEST_F()
1111 runWithSE(*M, "foo", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1112 auto *ScevInc = SE.getSCEV(getInstructionByName(F, "inc")); in TEST_F()
1142 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1143 auto *ScevV0 = SE.getSCEV(getInstructionByName(F, "v0")); // %pp in TEST_F()
1144 auto *ScevV3 = SE.getSCEV(getInstructionByName(F, "v3")); // (3 + %pp) in TEST_F()
1145 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); // {0,+,1} in TEST_F()
1146 auto *ScevXA = SE.getSCEV(getInstructionByName(F, "xa")); // {%pp,+,1} in TEST_F()
1147 auto *ScevYY = SE.getSCEV(getInstructionByName(F, "yy")); // {(3 + %pp),+,1} in TEST_F()
1148 auto *ScevXB = SE.getSCEV(getInstructionByName(F, "xb")); // {%pp,+,1} in TEST_F()
1149 auto *ScevIVNext = SE.getSCEV(getInstructionByName(F, "iv.next")); // {1,+,1} in TEST_F()
1151 auto diff = [&SE](const SCEV *LHS, const SCEV *RHS) -> Optional<int> { in TEST_F()
1152 auto ConstantDiffOrNone = computeConstantDifference(SE, LHS, RHS); in TEST_F()
1200 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1201 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); // {0,+,1} in TEST_F()
1202 auto *ScevI = SE.getSCEV(getArgByName(F, "i")); // {0,+,1} in TEST_F()
1206 SE.getUMinExpr(ScevI, SE.getConstant(ScevI->getType(), 17)); in TEST_F()
1207 auto *WithUMin = SCEVParameterRewriter::rewrite(ScevIV, SE, RewriteMap); in TEST_F()
1213 SE.getUMinExpr(ScevI, SE.getConstant(ScevI->getType(), 17))); in TEST_F()
1214 EXPECT_EQ(AR->getStepRecurrence(SE), in TEST_F()
1215 cast<SCEVAddRecExpr>(ScevIV)->getStepRecurrence(SE)); in TEST_F()
1230 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1231 auto *X = SE.getSCEV(getArgByName(F, "x")); in TEST_F()
1232 auto *One = SE.getOne(X->getType()); in TEST_F()
1233 auto *Sum = SE.getAddExpr(X, One, SCEV::FlagNUW); in TEST_F()
1234 EXPECT_TRUE(SE.isKnownPredicate(ICmpInst::ICMP_UGE, Sum, X)); in TEST_F()
1235 EXPECT_TRUE(SE.isKnownPredicate(ICmpInst::ICMP_UGT, Sum, X)); in TEST_F()
1256 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1257 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); // {0,+,1} in TEST_F()
1258 auto *ScevI = SE.getSCEV(getArgByName(F, "i")); in TEST_F()
1259 EXPECT_EQ(SE.getUnsignedRange(ScevIV).getLower(), 0); in TEST_F()
1260 EXPECT_EQ(SE.getUnsignedRange(ScevIV).getUpper(), 16); in TEST_F()
1262 auto *Add = SE.getAddExpr(ScevI, ScevIV); in TEST_F()
1265 SE.getUMinExpr(ScevI, SE.getConstant(ScevI->getType(), 17)); in TEST_F()
1266 auto *AddWithUMin = SCEVParameterRewriter::rewrite(Add, SE, RewriteMap); in TEST_F()
1267 EXPECT_EQ(SE.getUnsignedRange(AddWithUMin).getLower(), 0); in TEST_F()
1268 EXPECT_EQ(SE.getUnsignedRange(AddWithUMin).getUpper(), 33); in TEST_F()
1293 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1294 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); // {0,+,1} in TEST_F()
1297 const SCEV *BTC = SE.getBackedgeTakenCount(L); in TEST_F()
1299 const SCEV *MaxBTC = SE.getConstantMaxBackedgeTakenCount(L); in TEST_F()
1328 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1329 auto *X = SE.getSCEV(getInstructionByName(F, "x")); in TEST_F()
1331 EXPECT_TRUE(SE.isKnownPredicateAt(ICmpInst::ICMP_NE, X, in TEST_F()
1332 SE.getZero(X->getType()), Context)); in TEST_F()
1357 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1358 auto *X = SE.getSCEV(getInstructionByName(F, "x")); in TEST_F()
1359 auto *Y = SE.getSCEV(getInstructionByName(F, "y")); in TEST_F()
1363 SE.isBasicBlockEntryGuardedByCond(Guarded, ICmpInst::ICMP_ULT, Y, X)); in TEST_F()
1365 SE.isBasicBlockEntryGuardedByCond(Guarded, ICmpInst::ICMP_UGT, X, Y)); in TEST_F()
1400 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1401 auto *IV = SE.getSCEV(getInstructionByName(F, "iv")); in TEST_F()
1402 auto *Zero = SE.getZero(IV->getType()); in TEST_F()
1436 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1439 const SCEV *Zero = SE.getZero(Ty); in TEST_F()
1440 const SCEV *MinusOne = SE.getMinusOne(Ty); in TEST_F()
1442 const SCEV *AddRec_0_1 = SE.getSCEV(IV); in TEST_F()
1444 const SCEV *AddRec_0_N1 = SE.getNegativeSCEV(AddRec_0_1); in TEST_F()
1447 EXPECT_TRUE(isImpliedCond(SE, ICmpInst::ICMP_SLT, AddRec_0_N1, Zero, in TEST_F()
1450 EXPECT_TRUE(isImpliedCond(SE, ICmpInst::ICMP_SGT, AddRec_0_1, Zero, in TEST_F()
1477 runWithSE(*M, "test", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1480 auto *S = SE.getSCEV(URemI); in TEST_F()
1482 EXPECT_TRUE(matchURem(SE, S, LHS, RHS)); in TEST_F()
1483 EXPECT_EQ(LHS, SE.getSCEV(URemI->getOperand(0))); in TEST_F()
1484 EXPECT_EQ(RHS, SE.getSCEV(URemI->getOperand(1))); in TEST_F()
1493 auto *S = SE.getSCEV(Ext); in TEST_F()
1495 EXPECT_TRUE(matchURem(SE, S, LHS, RHS)); in TEST_F()
1496 EXPECT_NE(LHS, SE.getSCEV(URem1->getOperand(0))); in TEST_F()
1500 cast<SCEVConstant>(SE.getSCEV(URem1->getOperand(1))) in TEST_F()
1519 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1529 auto *NS = SE.getConstant(NInt); in TEST_F()
1530 auto *DS = SE.getConstant(DInt); in TEST_F()
1531 auto *FloorS = cast<SCEVConstant>(SE.getUDivExpr(NS, DS)); in TEST_F()
1532 auto *CeilingS = cast<SCEVConstant>(SE.getUDivCeilSCEV(NS, DS)); in TEST_F()
1569 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1570 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); in TEST_F()
1573 const SCEV *ITC = SE.getConstantMaxTripCountFromArray(L); in TEST_F()
1610 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1611 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); in TEST_F()
1614 const SCEV *ITC = SE.getConstantMaxTripCountFromArray(L); in TEST_F()
1651 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1652 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); in TEST_F()
1655 const SCEV *ITC = SE.getConstantMaxTripCountFromArray(L); in TEST_F()
1696 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1697 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); in TEST_F()
1700 const SCEV *ITC = SE.getConstantMaxTripCountFromArray(L); in TEST_F()
1738 runWithSE(*M, "foo", [](Function &F, LoopInfo &LI, ScalarEvolution &SE) { in TEST_F() argument
1739 auto *ScevIV = SE.getSCEV(getInstructionByName(F, "iv")); in TEST_F()
1742 const SCEV *ITC = SE.getConstantMaxTripCountFromArray(L); in TEST_F()