[llvm] [PatternMatch] m_SpecificMask should pass expected mask by Value. NFC (PR #121527)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 15:02:41 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/121527.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/PatternMatch.h (+3-3)
``````````diff
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 {
``````````
</details>
https://github.com/llvm/llvm-project/pull/121527
More information about the llvm-commits
mailing list