[llvm] [LV] Optimize x && (x && y) -> x && y (PR #185806)
Elvis Wang via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 15 20:07:50 PDT 2026
================
@@ -1374,6 +1374,12 @@ static void simplifyRecipe(VPSingleDefRecipe *Def, VPTypeAnalysis &TypeInfo) {
return Def->replaceAllUsesWith(
Builder.createLogicalAnd(X, Builder.createOr(Y, Z)));
+ // x && (x && y) -> x && y
+ if (match(Def, m_LogicalAnd(m_VPValue(X),
+ m_c_LogicalAnd(m_Deferred(X), m_VPValue(Y)))))
+ return Def->replaceAllUsesWith(
+ Def->getOperand(Def->getOperand(0) == X ? 1 : 0));
----------------
ElvisWang123 wrote:
Updated, thanks!
https://github.com/llvm/llvm-project/pull/185806
More information about the llvm-commits
mailing list