[llvm] [VPlan] Simplify worklist in reassociateHeaderMask. NFC (PR #181595)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 17 06:05:57 PST 2026
================
@@ -1623,27 +1607,29 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan) {
}
/// Reassociate (headermask && x) && y -> headermask && (x && y) to allow the
-/// header mask to be simplified further, e.g. in optimizeEVLMasks.
+/// header mask to be simplified further when tail folding, e.g. in
+/// optimizeEVLMasks.
static void reassociateHeaderMask(VPlan &Plan) {
VPValue *HeaderMask = vputils::findHeaderMask(Plan);
if (!HeaderMask)
return;
- SmallVector<VPUser *> Worklist(HeaderMask->users());
+
+ SmallVector<VPUser *> Worklist;
+ for (VPUser *U : HeaderMask->users())
+ if (match(U, m_LogicalAnd(m_Specific(HeaderMask), m_VPValue())))
+ append_range(Worklist, cast<VPSingleDefRecipe>(U)->users());
+
+ VPValue *X, *Y;
while (!Worklist.empty()) {
auto *R = dyn_cast<VPSingleDefRecipe>(Worklist.pop_back_val());
----------------
lukel97 wrote:
Done in 058cd23526f041a55fa546f8a551913e7fbcb05c
https://github.com/llvm/llvm-project/pull/181595
More information about the llvm-commits
mailing list