[llvm] [VPlan] Simplify VPBlendRecipes to select instructions (PR #133993)
    Luke Lau via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Jul  7 03:11:58 PDT 2025
    
    
  
================
@@ -1082,6 +1082,15 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
   if (match(Def, m_Select(m_VPValue(), m_VPValue(X), m_Deferred(X))))
     return Def->replaceAllUsesWith(X);
 
+  // select !c, x, y -> select c, y, x
+  VPValue *C;
+  if (match(Def, m_Select(m_Not(m_VPValue(C)), m_VPValue(X), m_VPValue(Y)))) {
+    Def->setOperand(0, C);
+    Def->setOperand(1, Y);
+    Def->setOperand(2, X);
+    return;
+  }
+
----------------
lukel97 wrote:
I think so, it's not that useful on its own but I've pushed https://github.com/llvm/llvm-project/pull/147268 anyway
https://github.com/llvm/llvm-project/pull/133993
    
    
More information about the llvm-commits
mailing list