[VPlan] Permit derived IV in isHeaderMask#187360
Conversation
When matching scalar steps of the canonical IV, also match a derived IV of the canonical IV if the derivation is essentially a no-op. Fixes a failure in the mve-reg-pressure-spills.ll test when expensive checks are enabled.
|
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-llvm-transforms Author: John Brawn (john-brawn-arm) ChangesWhen matching scalar steps of the canonical IV, also match a derived IV of the canonical IV if the derivation is essentially a no-op. Fixes a failure in the mve-reg-pressure-spills.ll test when expensive checks are enabled. Full diff: https://github.com/llvm/llvm-project/pull/187360.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
index ae6fb8e3e9cf5..7921a6fa0411e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
@@ -62,9 +62,10 @@ bool vputils::isHeaderMask(const VPValue *V, const VPlan &Plan) {
VPValue *A, *B;
- auto m_CanonicalScalarIVSteps =
- m_ScalarIVSteps(m_Specific(Plan.getVectorLoopRegion()->getCanonicalIV()),
- m_One(), m_Specific(&Plan.getVF()));
+ auto m_CanonicalScalarIVSteps = m_ScalarIVSteps(
+ m_CombineOr(m_CanonicalIV(),
+ m_DerivedIV(m_ZeroInt(), m_CanonicalIV(), m_One())),
+ m_One(), m_Specific(&Plan.getVF()));
if (match(V, m_ActiveLaneMask(m_VPValue(A), m_VPValue(B), m_One())))
return B == Plan.getTripCount() &&
|
fhahn
left a comment
There was a problem hiding this comment.
could you add a test case?
| m_One(), m_Specific(&Plan.getVF())); | ||
| auto m_CanonicalScalarIVSteps = m_ScalarIVSteps( | ||
| m_CombineOr(m_CanonicalIV(), | ||
| m_DerivedIV(m_ZeroInt(), m_CanonicalIV(), m_One())), |
There was a problem hiding this comment.
this looks like a missing fold, unless here's a different type?
There was a problem hiding this comment.
Uses of the DerivedIV do get replaced by the CanonicalIV in the simplifyRecipes vplan pass, and the DerivedIV is then removed in removeDeadRecipes, but the vplan verify failure is happening between it being added (by legalizeAndOptimizeInductions) and removed.
I think mve-reg-pressure-spills.ll fails without this with EXPENSIVE_CHECKS |
Ah right, might be good to pass |
Done |
🐧 Linux x64 Test Results
Failed Tests(click on a test name to see its output) lldb-apilldb-api.functionalities/data-formatter/data-formatter-stl/generic/list/TestDataFormatterGenericList.pyIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
| m_One(), m_Specific(&Plan.getVF())); | ||
| auto m_CanonicalScalarIVSteps = m_ScalarIVSteps( | ||
| m_CombineOr(m_CanonicalIV(), | ||
| m_DerivedIV(m_ZeroInt(), m_CanonicalIV(), m_One())), |
When matching scalar steps of the canonical IV, also match a derived IV of the canonical IV if the derivation is essentially a no-op. Fixes a failure in the mve-reg-pressure-spills.ll test when expensive checks are enabled.
When matching scalar steps of the canonical IV, also match a derived IV of the canonical IV if the derivation is essentially a no-op. Fixes a failure in the mve-reg-pressure-spills.ll test when expensive checks are enabled.