[llvm] [VPlan] Simplify select with constant condition (PR #150357)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 18:59:08 PDT 2025


================
@@ -1079,6 +1079,12 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
     return;
   }
 
+  if (match(Def, m_Select(m_True(), m_VPValue(X), m_VPValue())))
+    return Def->replaceAllUsesWith(X);
+
+  if (match(Def, m_Select(m_False(), m_VPValue(), m_VPValue(X))))
+    return Def->replaceAllUsesWith(X);
----------------
lukel97 wrote:

The fold on false isn't immediately used by the test cases in tree, but is needed in an upcoming patch, so I included it with the fold on true

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


More information about the llvm-commits mailing list