inline auto m_Undef() { return undef_match(); }
/// Match an arbitrary poison constant.
-inline class_match<PoisonValue> m_Poison() { return class_match<PoisonValue>(); }
+inline class_match<PoisonValue> m_Poison() {
+ return class_match<PoisonValue>();
+}
/// Match an arbitrary Constant and ignore it.
inline class_match<Constant> m_Constant() { return class_match<Constant>(); }
bool AllowUndef;
apint_match(const APInt *&Res, bool AllowUndef)
- : Res(Res), AllowUndef(AllowUndef) {}
+ : Res(Res), AllowUndef(AllowUndef) {}
template <typename ITy> bool match(ITy *V) {
if (auto *CI = dyn_cast<ConstantInt>(V)) {
}
if (V->getType()->isVectorTy())
if (const auto *C = dyn_cast<Constant>(V))
- if (auto *CI = dyn_cast_or_null<ConstantInt>(
- C->getSplatValue(AllowUndef))) {
+ if (auto *CI =
+ dyn_cast_or_null<ConstantInt>(C->getSplatValue(AllowUndef))) {
Res = &CI->getValue();
return true;
}
}
if (V->getType()->isVectorTy())
if (const auto *C = dyn_cast<Constant>(V))
- if (auto *CI = dyn_cast_or_null<ConstantFP>(
- C->getSplatValue(AllowUndef))) {
+ if (auto *CI =
+ dyn_cast_or_null<ConstantFP>(C->getSplatValue(AllowUndef))) {
Res = &CI->getValueAPF();
return true;
}
inline cst_pred_ty<is_negative> m_Negative() {
return cst_pred_ty<is_negative>();
}
-inline api_pred_ty<is_negative> m_Negative(const APInt *&V) {
- return V;
-}
+inline api_pred_ty<is_negative> m_Negative(const APInt *&V) { return V; }
struct is_nonnegative {
bool isValue(const APInt &C) { return C.isNonNegative(); }
inline cst_pred_ty<is_nonnegative> m_NonNegative() {
return cst_pred_ty<is_nonnegative>();
}
-inline api_pred_ty<is_nonnegative> m_NonNegative(const APInt *&V) {
- return V;
-}
+inline api_pred_ty<is_nonnegative> m_NonNegative(const APInt *&V) { return V; }
struct is_strictlypositive {
bool isValue(const APInt &C) { return C.isStrictlyPositive(); }
};
/// Match an integer 1 or a vector with all elements equal to 1.
/// For vectors, this includes constants with undefined elements.
-inline cst_pred_ty<is_one> m_One() {
- return cst_pred_ty<is_one>();
-}
+inline cst_pred_ty<is_one> m_One() { return cst_pred_ty<is_one>(); }
struct is_zero_int {
bool isValue(const APInt &C) { return C.isZero(); }
};
/// Match any null constant or a vector with all elements equal to 0.
/// For vectors, this includes constants with undefined elements.
-inline is_zero m_Zero() {
- return is_zero();
-}
+inline is_zero m_Zero() { return is_zero(); }
struct is_power2 {
bool isValue(const APInt &C) { return C.isPowerOf2(); }
};
/// Match an integer or vector power-of-2.
/// For vectors, this includes constants with undefined elements.
-inline cst_pred_ty<is_power2> m_Power2() {
- return cst_pred_ty<is_power2>();
-}
-inline api_pred_ty<is_power2> m_Power2(const APInt *&V) {
- return V;
-}
+inline cst_pred_ty<is_power2> m_Power2() { return cst_pred_ty<is_power2>(); }
+inline api_pred_ty<is_power2> m_Power2(const APInt *&V) { return V; }
struct is_negated_power2 {
bool isValue(const APInt &C) { return C.isNegatedPowerOf2(); }
inline cst_pred_ty<is_lowbit_mask> m_LowBitMask() {
return cst_pred_ty<is_lowbit_mask>();
}
-inline api_pred_ty<is_lowbit_mask> m_LowBitMask(const APInt *&V) {
- return V;
-}
+inline api_pred_ty<is_lowbit_mask> m_LowBitMask(const APInt *&V) { return V; }
struct icmp_pred_with_threshold {
ICmpInst::Predicate Pred;
};
/// Match an arbitrary NaN constant. This includes quiet and signalling nans.
/// For vectors, this includes constants with undefined elements.
-inline cstfp_pred_ty<is_nan> m_NaN() {
- return cstfp_pred_ty<is_nan>();
-}
+inline cstfp_pred_ty<is_nan> m_NaN() { return cstfp_pred_ty<is_nan>(); }
struct is_nonnan {
bool isValue(const APFloat &C) { return !C.isNaN(); }
};
/// Match a positive or negative infinity FP constant.
/// For vectors, this includes constants with undefined elements.
-inline cstfp_pred_ty<is_inf> m_Inf() {
- return cstfp_pred_ty<is_inf>();
-}
+inline cstfp_pred_ty<is_inf> m_Inf() { return cstfp_pred_ty<is_inf>(); }
struct is_noninf {
bool isValue(const APFloat &C) { return !C.isInfinity(); }
/// Match a binary operator, capturing it if we match.
inline bind_ty<BinaryOperator> m_BinOp(BinaryOperator *&I) { return I; }
/// Match a with overflow intrinsic, capturing it if we match.
-inline bind_ty<WithOverflowInst> m_WithOverflowInst(WithOverflowInst *&I) { return I; }
+inline bind_ty<WithOverflowInst> m_WithOverflowInst(WithOverflowInst *&I) {
+ return I;
+}
inline bind_ty<const WithOverflowInst>
m_WithOverflowInst(const WithOverflowInst *&I) {
return I;
/// Match a specified integer value or vector of all elements of that
/// value.
-template <bool AllowUndefs>
-struct specific_intval {
+template <bool AllowUndefs> struct specific_intval {
APInt Val;
specific_intval(APInt V) : Val(std::move(V)) {}
FNeg_match(const Op_t &Op) : X(Op) {}
template <typename OpTy> bool match(OpTy *V) {
auto *FPMO = dyn_cast<FPMathOperator>(V);
- if (!FPMO) return false;
+ if (!FPMO)
+ return false;
if (FPMO->getOpcode() == Instruction::FNeg)
return X.match(FPMO->getOperand(0));
};
/// Match 'fneg X' as 'fsub -0.0, X'.
-template <typename OpTy>
-inline FNeg_match<OpTy>
-m_FNeg(const OpTy &X) {
+template <typename OpTy> inline FNeg_match<OpTy> m_FNeg(const OpTy &X) {
return FNeg_match<OpTy>(X);
}
OverflowingBinaryOperator::NoSignedWrap>
m_NSWAdd(const LHS &L, const RHS &R) {
return OverflowingBinaryOp_match<LHS, RHS, Instruction::Add,
- OverflowingBinaryOperator::NoSignedWrap>(
- L, R);
+ OverflowingBinaryOperator::NoSignedWrap>(L,
+ R);
}
template <typename LHS, typename RHS>
inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Sub,
OverflowingBinaryOperator::NoSignedWrap>
m_NSWSub(const LHS &L, const RHS &R) {
return OverflowingBinaryOp_match<LHS, RHS, Instruction::Sub,
- OverflowingBinaryOperator::NoSignedWrap>(
- L, R);
+ OverflowingBinaryOperator::NoSignedWrap>(L,
+ R);
}
template <typename LHS, typename RHS>
inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Mul,
OverflowingBinaryOperator::NoSignedWrap>
m_NSWMul(const LHS &L, const RHS &R) {
return OverflowingBinaryOp_match<LHS, RHS, Instruction::Mul,
- OverflowingBinaryOperator::NoSignedWrap>(
- L, R);
+ OverflowingBinaryOperator::NoSignedWrap>(L,
+ R);
}
template <typename LHS, typename RHS>
inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Shl,
OverflowingBinaryOperator::NoSignedWrap>
m_NSWShl(const LHS &L, const RHS &R) {
return OverflowingBinaryOp_match<LHS, RHS, Instruction::Shl,
- OverflowingBinaryOperator::NoSignedWrap>(
- L, R);
+ OverflowingBinaryOperator::NoSignedWrap>(L,
+ R);
}
template <typename LHS, typename RHS>
Predicate = I->getPredicate();
return true;
} else if (Commutable && L.match(I->getOperand(1)) &&
- R.match(I->getOperand(0))) {
+ R.match(I->getOperand(0))) {
Predicate = I->getSwappedPredicate();
return true;
}
};
template <typename T0, typename T1, typename T2>
struct m_Intrinsic_Ty<T0, T1, T2> {
- using Ty =
- match_combine_and<typename m_Intrinsic_Ty<T0, T1>::Ty,
- Argument_match<T2>>;
+ using Ty = match_combine_and<typename m_Intrinsic_Ty<T0, T1>::Ty,
+ Argument_match<T2>>;
};
template <typename T0, typename T1, typename T2, typename T3>
struct m_Intrinsic_Ty<T0, T1, T2, T3> {
- using Ty =
- match_combine_and<typename m_Intrinsic_Ty<T0, T1, T2>::Ty,
- Argument_match<T3>>;
+ using Ty = match_combine_and<typename m_Intrinsic_Ty<T0, T1, T2>::Ty,
+ Argument_match<T3>>;
};
template <typename T0, typename T1, typename T2, typename T3, typename T4>
Argument_match<T4>>;
};
-template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
+template <typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5>
struct m_Intrinsic_Ty<T0, T1, T2, T3, T4, T5> {
using Ty = match_combine_and<typename m_Intrinsic_Ty<T0, T1, T2, T3, T4>::Ty,
Argument_match<T5>>;
/// Matches L && R either in the form of L & R or L ? R : false.
/// Note that the latter form is poison-blocking.
template <typename LHS, typename RHS>
-inline LogicalOp_match<LHS, RHS, Instruction::And>
-m_LogicalAnd(const LHS &L, const RHS &R) {
+inline LogicalOp_match<LHS, RHS, Instruction::And> m_LogicalAnd(const LHS &L,
+ const RHS &R) {
return LogicalOp_match<LHS, RHS, Instruction::And>(L, R);
}
/// Matches L || R either in the form of L | R or L ? true : R.
/// Note that the latter form is poison-blocking.
template <typename LHS, typename RHS>
-inline LogicalOp_match<LHS, RHS, Instruction::Or>
-m_LogicalOr(const LHS &L, const RHS &R) {
+inline LogicalOp_match<LHS, RHS, Instruction::Or> m_LogicalOr(const LHS &L,
+ const RHS &R) {
return LogicalOp_match<LHS, RHS, Instruction::Or>(L, R);
}