@@ -1299,17 +1299,26 @@ class ScalarEvolution {
1299
1299
// / sharpen it.
1300
1300
void setNoWrapFlags (SCEVAddRecExpr *AddRec, SCEV::NoWrapFlags Flags);
1301
1301
1302
- // / Collect rewrite map for loop guards for loop \p L, together with flags
1303
- // / indidcating if NUW and NSW can be preserved during rewriting.
1304
- std::tuple<DenseMap<const SCEV *, const SCEV *>, bool , bool >
1305
- collectRewriteInfoFromLoopGuards (const Loop *L);
1302
+ class LoopGuards {
1303
+ DenseMap<const SCEV *, const SCEV *> RewriteMap;
1304
+ bool PreserveNUW = false ;
1305
+ bool PreserveNSW = false ;
1306
+ ScalarEvolution &SE;
1307
+
1308
+ LoopGuards (ScalarEvolution &SE) : SE(SE) {}
1309
+
1310
+ public:
1311
+ // / Collect rewrite map for loop guards for loop \p L, together with flags
1312
+ // / indidcating if NUW and NSW can be preserved during rewriting.
1313
+ static LoopGuards collect (const Loop *L, ScalarEvolution &SE);
1314
+
1315
+ // / Try to apply the collected loop guards to \p Expr
1316
+ const SCEV *rewrite (const SCEV *Expr) const ;
1317
+ };
1306
1318
1307
1319
// / Try to apply information from loop guards for \p L to \p Expr.
1308
1320
const SCEV *applyLoopGuards (const SCEV *Expr, const Loop *L);
1309
- const SCEV *
1310
- applyLoopGuards (const SCEV *Expr, const Loop *L,
1311
- const DenseMap<const SCEV *, const SCEV *> &RewriteMap,
1312
- bool PreserveNUW, bool PreserveNSW);
1321
+ const SCEV *applyLoopGuards (const SCEV *Expr, const LoopGuards &Gards);
1313
1322
1314
1323
// / Return true if the loop has no abnormal exits. That is, if the loop
1315
1324
// / is not infinite, it must exit through an explicit edge in the CFG.
0 commit comments