[llvm] [VPlan] Remove redundant x && (y && x) -> x && y combine (PR #213219)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 31 01:15:54 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-vectorizers
Author: Luke Lau (lukel97)
<details>
<summary>Changes</summary>
It can be subsumed by making the combine above commutative. In theory this isn't NFC as it changes the order, in practice it doesn't make a difference.
---
Full diff: https://github.com/llvm/llvm-project/pull/213219.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp (+2-9)
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 9990fd142df02..5bb96cd070fa5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -1192,19 +1192,12 @@ static bool simplifyLogicalRecipe(VPSingleDefRecipe *Def, VPBuilder &Builder,
}
// x && (x && y) -> x && y
- if (match(Def, m_LogicalAnd(m_VPValue(X),
- m_LogicalAnd(m_Deferred(X), m_VPValue())))) {
+ if (match(Def, m_c_LogicalAnd(m_VPValue(X),
+ m_c_LogicalAnd(m_Deferred(X), m_VPValue())))) {
Def->replaceAllUsesWith(Def->getOperand(1));
return true;
}
- // x && (y && x) -> x && y
- if (match(Def, m_LogicalAnd(m_VPValue(X),
- m_LogicalAnd(m_VPValue(Y), m_Deferred(X))))) {
- Def->replaceAllUsesWith(Builder.createLogicalAnd(X, Y));
- return true;
- }
-
// x && !x -> 0
if (match(Def, m_LogicalAnd(m_VPValue(X), m_Not(m_Deferred(X))))) {
Def->replaceAllUsesWith(Plan->getFalse());
``````````
</details>
https://github.com/llvm/llvm-project/pull/213219
More information about the llvm-commits
mailing list