[all-commits] [llvm/llvm-project] 281028: [LoopInterchange] Prevent from undoing its own tra...
Ryotaro Kasuga via All-commits
all-commits at lists.llvm.org
Fri Mar 21 05:43:11 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 281028e37ca6c97c62ba68cd43eda2ff95bc70c4
https://github.com/llvm/llvm-project/commit/281028e37ca6c97c62ba68cd43eda2ff95bc70c4
Author: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
Date: 2025-03-21 (Fri, 21 Mar 2025)
Changed paths:
M llvm/lib/Transforms/Scalar/LoopInterchange.cpp
A llvm/test/Transforms/LoopInterchange/profitability-redundant-interchange.ll
Log Message:
-----------
[LoopInterchange] Prevent from undoing its own transformation (#127473)
LoopInterchange uses the bubble-sort fashion algorithm to sort the loops
in a loop nest. For two loops `A` and `B`, it calls `isProfitable(A, B)`
to determine whether these loops should be exchanged. The result of
`isProfitable(A, B)` should be conservative, that is, it should return
true only when we are sure exchanging `A` and `B` will improve
performance. If it's not conservative enough, it's possible that a
subsequent `isProfitable(B, A)` will also return true, in which case
LoopInterchange will undo its previous transformation. To avoid such
cases, `isProfitable(B, A)` must not return true if `isProfitable(A, B)`
returned true in the past. However, the current implementation can be in
such a situation. This patch resolves it by correcting the handling of
two loops that have the same cache cost.
This resolve the problem mentioned in
https://github.com/llvm/llvm-project/pull/118267#issuecomment-2510759354.
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