[llvm] Remove Signum_match template and its implementation (PR #210629)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 14:43:34 PDT 2026
https://github.com/zip-stack-debug created https://github.com/llvm/llvm-project/pull/210629
Removed Signum_match template and associated matching logic from PatternMatch.h.
>From fe3dc61c185a8171459f4ba3da9630b7b5d8e148 Mon Sep 17 00:00:00 2001
From: zip-stack-debug <doremyalt at gmail.com>
Date: Sun, 19 Jul 2026 17:43:06 -0400
Subject: [PATCH] Remove Signum_match template and its implementation
Removed Signum_match template and associated matching logic from PatternMatch.h.
---
llvm/include/llvm/IR/PatternMatch.h | 40 -----------------------------
1 file changed, 40 deletions(-)
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index ca1dd7b46a6c4..586e6a3049a4c 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -3119,46 +3119,6 @@ m_c_FMul(const LHS &L, const RHS &R) {
return BinaryOp_match<LHS, RHS, Instruction::FMul, true>(L, R);
}
-template <typename Opnd_t> struct Signum_match {
- Opnd_t Val;
- Signum_match(const Opnd_t &V) : Val(V) {}
-
- template <typename OpTy> bool match(OpTy *V) const {
- unsigned TypeSize = V->getType()->getScalarSizeInBits();
- if (TypeSize == 0)
- return false;
-
- unsigned ShiftWidth = TypeSize - 1;
- Value *Op;
-
- // This is the representation of signum we match:
- //
- // signum(x) == (x >> 63) | (-x >>u 63)
- //
- // An i1 value is its own signum, so it's correct to match
- //
- // signum(x) == (x >> 0) | (-x >>u 0)
- //
- // for i1 values.
-
- auto LHS = m_AShr(m_Value(Op), m_SpecificInt(ShiftWidth));
- auto RHS = m_LShr(m_Neg(m_Deferred(Op)), m_SpecificInt(ShiftWidth));
- auto Signum = m_c_Or(LHS, RHS);
-
- return Signum.match(V) && Val.match(Op);
- }
-};
-
-/// Matches a signum pattern.
-///
-/// signum(x) =
-/// x > 0 -> 1
-/// x == 0 -> 0
-/// x < 0 -> -1
-template <typename Val_t> inline Signum_match<Val_t> m_Signum(const Val_t &V) {
- return Signum_match<Val_t>(V);
-}
-
template <int Ind, typename Opnd_t> struct ExtractValue_match {
Opnd_t Val;
ExtractValue_match(const Opnd_t &V) : Val(V) {}
More information about the llvm-commits
mailing list