Skip to content

Commit af03d35

Browse files
committed
!fixup use cst_pred_ty for zero matcher
1 parent 8758a1d commit af03d35

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,10 @@ template <typename Predicate> struct cst_pred_ty : public Predicate {
3333
};
3434

3535
struct is_zero {
36-
template <typename ITy> bool match(ITy *S) {
37-
assert((isa<SCEVCouldNotCompute>(S) || !S->getType()->isVectorTy()) &&
38-
"no vector types expected from SCEVs");
39-
auto *C = dyn_cast<SCEVConstant>(S);
40-
return C && C->getValue()->isNullValue();
41-
}
36+
bool isValue(const APInt &C) { return C.isZero(); }
4237
};
43-
/// Match any null constant.
44-
inline is_zero m_scev_Zero() { return is_zero(); }
38+
/// Match an integer 0.
39+
inline cst_pred_ty<is_zero> m_scev_Zero() { return cst_pred_ty<is_zero>(); }
4540

4641
struct is_one {
4742
bool isValue(const APInt &C) { return C.isOne(); }

0 commit comments

Comments
 (0)