[llvm] [PatternMatch] m_SpecificMask should pass expected mask by Value. NFC (PR #121527)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 15:02:08 PST 2025
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/121527
Unlike m_Mask, we don't need to modify a variable owned by the caller so we should pass the ArrayRef by value or const reference.
>From e5542a323b6b11a875f237bc2539bbd0ac0de281 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 2 Jan 2025 14:58:26 -0800
Subject: [PATCH] [PatternMatch] m_SpecificMask should pass expected mask by
Value. NFC
Unlike m_Mask, we don't need to modify a variable owned by the caller
so we should pass the ArrayRef by value or const reference.
---
llvm/include/llvm/IR/PatternMatch.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index cc0e8d598ff1ea..b37f967191aaa8 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -1844,9 +1844,9 @@ struct m_ZeroMask {
};
struct m_SpecificMask {
- ArrayRef<int> &MaskRef;
- m_SpecificMask(ArrayRef<int> &MaskRef) : MaskRef(MaskRef) {}
- bool match(ArrayRef<int> Mask) { return MaskRef == Mask; }
+ ArrayRef<int> Val;
+ m_SpecificMask(ArrayRef<int> Val) : Val(Val) {}
+ bool match(ArrayRef<int> Mask) { return Val == Mask; }
};
struct m_SplatOrPoisonMask {
More information about the llvm-commits
mailing list