[llvm] [InstCombineCasts] Undef -> poison only for certain optimizations (PR #201631)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 12:52:51 PDT 2026


================
@@ -1957,15 +1957,22 @@ template <typename T0, typename T1, typename T2> struct Shuffle_match {
   }
 };
 
-struct m_Mask {
+struct Mask_match {
   ArrayRef<int> &MaskRef;
-  m_Mask(ArrayRef<int> &MaskRef) : MaskRef(MaskRef) {}
+  Mask_match(ArrayRef<int> &MaskRef) : MaskRef(MaskRef) {}
   bool match(ArrayRef<int> Mask) const {
     MaskRef = Mask;
     return true;
   }
 };
 
+inline Mask_match m_Mask(ArrayRef<int> &MaskRef) { return Mask_match(MaskRef); }
+
+template <typename Pattern>
+inline auto m_Mask(ArrayRef<int> &MaskRef, const Pattern &P) {
+  return m_CombineAnd(P, m_Mask(MaskRef));
+}
----------------
artagnon wrote:

So m_Mask binds the first argument, and checks the pattern in the second argument? Seems like we should not have it, as it's quite confusing what it does in usages?

https://github.com/llvm/llvm-project/pull/201631


More information about the llvm-commits mailing list