[llvm] [VPlan] Introduce m_c_Logical(And|Or), simplify x && true -> x (PR #180048)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 8 13:48:59 PST 2026


================
@@ -1287,8 +1287,12 @@ static void simplifyRecipe(VPSingleDefRecipe *Def, VPTypeAnalysis &TypeInfo) {
     return Def->replaceAllUsesWith(Def->getOperand(Def->getOperand(0) == X));
 
   // x && false -> false
-  if (match(Def, m_LogicalAnd(m_VPValue(X), m_False())))
-    return Def->replaceAllUsesWith(Def->getOperand(1));
+  if (match(Def, m_c_LogicalAnd(m_VPValue(X), m_False())))
+    return Def->replaceAllUsesWith(Plan->getFalse());
+
+  // x && true -> x
+  if (match(Def, m_c_LogicalAnd(m_VPValue(X), m_True())))
+    return Def->replaceAllUsesWith(X);
----------------
artagnon wrote:

Hm, I'm thinking that we can probably merge #179426 as-is, and put up this patch to show that there's no additional test coverage gained from m_c_Logical(And|Or)?

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


More information about the llvm-commits mailing list