[all-commits] [llvm/llvm-project] 55f9ec: [LV] Revert back to use Loop::isLoopInvariant in i...

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue Jul 29 12:32:53 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 55f9eccee9b5ca6102206d4a1aba9ca21070881d
      https://github.com/llvm/llvm-project/commit/55f9eccee9b5ca6102206d4a1aba9ca21070881d
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2025-07-29 (Tue, 29 Jul 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/predicatedinst-loop-invariant.ll

  Log Message:
  -----------
  [LV] Revert back to use Loop::isLoopInvariant in isPredicatedInst. (#150828)

This partially reverts https://github.com/llvm/llvm-project/pull/140744,
restoring the original TheLoop->isLoopInvariant check instead the more
powerful Legal->isInvariant, which uses SCEV.

This causes a mis-compile, because SCEV can prove that the stored value
is loop-invariant, which in turn converts the store to a uniform store.
But in VPlan, we aren't yet able to determine that the stored value is
loop-invariant, so we extract the last lane, which is incorrect, because
it does not account for the mask of the store.

Restoring the original code is a safe fix and avoids this subtle
divergence.

Fixes https://github.com/llvm/llvm-project/issues/149347.

PR: https://github.com/llvm/llvm-project/pull/150828



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