[all-commits] [llvm/llvm-project] 3482a9: [VPlan] Explicitly reassociate header mask in logi...

Luke Lau via All-commits all-commits at lists.llvm.org
Thu Feb 12 06:56:40 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3482a9c6cba57b4e605c2b99fb6d90a023439f9b
      https://github.com/llvm/llvm-project/commit/3482a9c6cba57b4e605c2b99fb6d90a023439f9b
  Author: Luke Lau <luke at igalia.com>
  Date:   2026-02-12 (Thu, 12 Feb 2026)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
    M llvm/test/Transforms/LoopVectorize/AArch64/force-target-instruction-cost.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-complex-mask.ll
    M llvm/test/Transforms/LoopVectorize/VPlan/vplan-print-after-all.ll
    M llvm/test/Transforms/LoopVectorize/X86/predicate-switch.ll
    M llvm/test/Transforms/LoopVectorize/reduction-inloop.ll

  Log Message:
  -----------
  [VPlan] Explicitly reassociate header mask in logical and (#180898)

We reassociate ((x && y) && z) -> (x && (y && z)) if x has more than
use, in order to allow simplifying the header mask further. However this
is somewhat unreliable as there are times when it doesn't have more than
one use, e.g. see the case we run into in
https://github.com/llvm/llvm-project/pull/173265/changes#r2769759907.

This moves it into a separate transformation that always reassociates
the header mask regardless of the number of uses, which prevents some
fragile test changes in #173265.

We need to run it before both calls to simplifyRecipes in optimize. I
considered putting it in simplifyRecipes itself but simplifyRecipes is
also called after unrolling and when the loop region is dissolved which
causes vputils::findHeaderMask to assert.

There isn't really any benefit to reassociating masks that aren't the
header mask so the existing simplification was removed.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list