[llvm] [InstCombine] Fold selects into masked loads (PR #160522)
    Matthew Devereau via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Sep 24 07:10:28 PDT 2025
    
    
  
================
@@ -4611,5 +4611,16 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
       return replaceOperand(SI, 2, ConstantInt::get(FalseVal->getType(), 0));
   }
 
+  Value *MaskedLoadPtr;
+  const APInt *MaskedLoadAlignment;
+  if (match(TrueVal,
+            m_MaskedLoad(m_Value(MaskedLoadPtr), m_APInt(MaskedLoadAlignment),
+                         m_Specific(CondVal), m_Value())))
----------------
MDevereau wrote:
Thanks, I've added a check & test for it
https://github.com/llvm/llvm-project/pull/160522
    
    
More information about the llvm-commits
mailing list