[all-commits] [llvm/llvm-project] efdd08: [LoopInterchange] Reject if outer loop reduction h...

Ryotaro Kasuga via All-commits all-commits at lists.llvm.org
Thu Jun 11 08:47:50 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: efdd089088747136ebf134f4fc0b56ccf25bb118
      https://github.com/llvm/llvm-project/commit/efdd089088747136ebf134f4fc0b56ccf25bb118
  Author: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopInterchange.cpp
    M llvm/test/Transforms/LoopInterchange/reduction-extra-use-in-inner-loop.ll

  Log Message:
  -----------
  [LoopInterchange] Reject if outer loop reduction has extra user (#203241)

As demonstrated by the case reported in #203104, there are cases where
interchanging the loops is unsafe because the outer loop reduction is
used within the inner loop by something other than the PHI node that
receives the value. Such cases should be rejected during the legality
check phase.
This patch adds a check to ensure that the outer loop reduction is only
used by the inner loop reduction PHI node. This check might be too
conservative and could cause missed optimizations, but at the moment I
can't find such a case.

Fixes #203104.



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