@@ -184,6 +184,7 @@ m_scev_PtrToInt(const Op0_t &Op0) {
184
184
185
185
// / Match a binary SCEV.
186
186
template <typename SCEVTy, typename Op0_t, typename Op1_t,
187
+ SCEV::NoWrapFlags WrapFlags = SCEV::FlagAnyWrap,
187
188
bool Commutable = false >
188
189
struct SCEVBinaryExpr_match {
189
190
Op0_t Op0;
@@ -192,6 +193,10 @@ struct SCEVBinaryExpr_match {
192
193
SCEVBinaryExpr_match (Op0_t Op0, Op1_t Op1) : Op0(Op0), Op1(Op1) {}
193
194
194
195
bool match (const SCEV *S) const {
196
+ if (auto WrappingS = dyn_cast<SCEVNAryExpr>(S))
197
+ if (WrappingS->getNoWrapFlags (WrapFlags) != WrapFlags)
198
+ return false ;
199
+
195
200
auto *E = dyn_cast<SCEVTy>(S);
196
201
return E && E->getNumOperands () == 2 &&
197
202
((Op0.match (E->getOperand (0 )) && Op1.match (E->getOperand (1 ))) ||
@@ -201,10 +206,12 @@ struct SCEVBinaryExpr_match {
201
206
};
202
207
203
208
template <typename SCEVTy, typename Op0_t, typename Op1_t,
209
+ SCEV::NoWrapFlags WrapFlags = SCEV::FlagAnyWrap,
204
210
bool Commutable = false >
205
- inline SCEVBinaryExpr_match<SCEVTy, Op0_t, Op1_t, Commutable>
211
+ inline SCEVBinaryExpr_match<SCEVTy, Op0_t, Op1_t, WrapFlags, Commutable>
206
212
m_scev_Binary (const Op0_t &Op0, const Op1_t &Op1) {
207
- return SCEVBinaryExpr_match<SCEVTy, Op0_t, Op1_t, Commutable>(Op0, Op1);
213
+ return SCEVBinaryExpr_match<SCEVTy, Op0_t, Op1_t, WrapFlags, Commutable>(Op0,
214
+ Op1);
208
215
}
209
216
210
217
template <typename Op0_t, typename Op1_t>
@@ -220,9 +227,17 @@ m_scev_Mul(const Op0_t &Op0, const Op1_t &Op1) {
220
227
}
221
228
222
229
template <typename Op0_t, typename Op1_t>
223
- inline SCEVBinaryExpr_match<SCEVMulExpr, Op0_t, Op1_t, true >
230
+ inline SCEVBinaryExpr_match<SCEVMulExpr, Op0_t, Op1_t, SCEV::FlagAnyWrap, true >
224
231
m_scev_c_Mul (const Op0_t &Op0, const Op1_t &Op1) {
225
- return m_scev_Binary<SCEVMulExpr, Op0_t, Op1_t, true >(Op0, Op1);
232
+ return m_scev_Binary<SCEVMulExpr, Op0_t, Op1_t, SCEV::FlagAnyWrap, true >(Op0,
233
+ Op1);
234
+ }
235
+
236
+ template <typename Op0_t, typename Op1_t>
237
+ inline SCEVBinaryExpr_match<SCEVMulExpr, Op0_t, Op1_t, SCEV::FlagNUW, true >
238
+ m_scev_c_NUWMul (const Op0_t &Op0, const Op1_t &Op1) {
239
+ return m_scev_Binary<SCEVMulExpr, Op0_t, Op1_t, SCEV::FlagNUW, true >(Op0,
240
+ Op1);
226
241
}
227
242
228
243
template <typename Op0_t, typename Op1_t>
0 commit comments