[all-commits] [llvm/llvm-project] 6dc6ca: [LoopInterchange] Skip legality check if surroundi...

Ryotaro Kasuga via All-commits all-commits at lists.llvm.org
Mon May 12 18:19:39 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6dc6ca3302edadad7d4b195a05038995b84606d0
      https://github.com/llvm/llvm-project/commit/6dc6ca3302edadad7d4b195a05038995b84606d0
  Author: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
  Date:   2025-05-13 (Tue, 13 May 2025)

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

  Log Message:
  -----------
  [LoopInterchange] Skip legality check if surrounding loops already guarantee dependency (NFC) (#139254)

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 a code to skip legality check if surrounding loops
already guarantee that the direction vector is lexicographically
positive. Note that this is only a small improvement on its own, but
it's necessary to relax the legality check I'm working on.

Split off from #118267

---------

Co-authored-by: Michael Kruse <llvm-project at meinersbur.de>



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