[all-commits] [llvm/llvm-project] bc145d: [LoopInterchange] Exit early in certain cases in l...

Ryotaro Kasuga via All-commits all-commits at lists.llvm.org
Fri May 9 05:32:52 PDT 2025


  Branch: refs/heads/users/kasuga-fj/loop-interchange-legality-prefix
  Home:   https://github.com/llvm/llvm-project
  Commit: bc145d6a4cb91e311af482d85fa2e7f91c29f200
      https://github.com/llvm/llvm-project/commit/bc145d6a4cb91e311af482d85fa2e7f91c29f200
  Author: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
  Date:   2025-05-09 (Fri, 09 May 2025)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopInterchange.cpp

  Log Message:
  -----------
  [LoopInterchange] Exit early in certain cases in legality check (NFC)

The legality check in LoopInterchange allows two loops to be exchanged
if all direction vectors are lexicographically positive (or zero) for
both before and after the swap. The current implementation performs this
routine naively.  However, if a direction vector is lexicographically
positive due to an element corresponding to a loop that is outside the
given two loops (i.e., if there is an element `<` before the loops we
are trying to interchange), then obviously it is also positive after
exchanging them. For example, for a direction vector `[< < >]`, swapping
the last two elements doesn't make it lexicographically negative because
the first element is `<`.
This patch adds an early exit logic for such cases. Note that this is
only a small improvement on its own, but it's necessary to relax the
legality check I'm working on.



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