[llvm] 746908a - [NFC] Clang-format PatternMatch.h
Simon Moll via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 9 07:54:41 PDT 2022
Author: Simon Moll
Date: 2022-06-09T16:51:32+02:00
New Revision: 746908a0380cbb5ad999e9ff08cdfd6caf7d3de3
URL: https://github.com/llvm/llvm-project/commit/746908a0380cbb5ad999e9ff08cdfd6caf7d3de3
DIFF: https://github.com/llvm/llvm-project/commit/746908a0380cbb5ad999e9ff08cdfd6caf7d3de3.diff
LOG: [NFC] Clang-format PatternMatch.h
Added:
Modified:
llvm/include/llvm/IR/PatternMatch.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index 9c1834a2c3248..7f0695b552e18 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -136,7 +136,9 @@ struct undef_match {
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>(); }
@@ -222,7 +224,7 @@ struct apint_match {
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)) {
@@ -231,8 +233,8 @@ struct apint_match {
}
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;
}
@@ -256,8 +258,8 @@ struct apfloat_match {
}
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;
}
@@ -467,9 +469,7 @@ struct is_negative {
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(); }
@@ -479,9 +479,7 @@ struct is_nonnegative {
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(); }
@@ -510,9 +508,7 @@ struct is_one {
};
/// 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(); }
@@ -532,21 +528,15 @@ struct is_zero {
};
/// 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(); }
@@ -589,9 +579,7 @@ struct is_lowbit_mask {
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;
@@ -613,9 +601,7 @@ struct is_nan {
};
/// 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(); }
@@ -631,9 +617,7 @@ struct is_inf {
};
/// 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(); }
@@ -729,7 +713,9 @@ inline bind_ty<UnaryOperator> m_UnOp(UnaryOperator *&I) { return I; }
/// 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;
@@ -842,8 +828,7 @@ struct bind_const_intval_ty {
/// 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)) {}
@@ -1014,7 +999,8 @@ template <typename Op_t> struct FNeg_match {
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));
@@ -1038,9 +1024,7 @@ template <typename Op_t> struct FNeg_match {
};
/// 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);
}
@@ -1165,32 +1149,32 @@ inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Add,
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>
@@ -1384,7 +1368,7 @@ struct CmpClass_match {
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;
}
@@ -2080,15 +2064,13 @@ template <typename T0, typename T1> struct m_Intrinsic_Ty<T0, T1> {
};
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>
@@ -2097,7 +2079,8 @@ struct m_Intrinsic_Ty<T0, T1, T2, T3, 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>>;
@@ -2545,8 +2528,8 @@ struct LogicalOp_match {
/// 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);
}
@@ -2563,8 +2546,8 @@ m_c_LogicalAnd(const LHS &L, const RHS &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);
}
More information about the llvm-commits
mailing list