[llvm] c19f0f0 - [PatternMatch] Make m_SpecificMask pass expected mask by Value. NFC (#121527)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 09:20:34 PST 2025


Author: Craig Topper
Date: 2025-01-03T09:20:30-08:00
New Revision: c19f0f005a1ccf21bd2f0656f90455a55413a32f

URL: https://github.com/llvm/llvm-project/commit/c19f0f005a1ccf21bd2f0656f90455a55413a32f
DIFF: https://github.com/llvm/llvm-project/commit/c19f0f005a1ccf21bd2f0656f90455a55413a32f.diff

LOG: [PatternMatch] Make m_SpecificMask pass expected mask by Value. NFC (#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.

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 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