[all-commits] [llvm/llvm-project] 7263e8: [LoopUnroll][NFC] Clean up remainder followup meta...
Joel E. Denny via All-commits
all-commits at lists.llvm.org
Mon Oct 27 09:19:48 PDT 2025
Branch: refs/heads/users/jdenny-ornl/unroll-cleanup-remainder-followup
Home: https://github.com/llvm/llvm-project
Commit: 7263e8e065e66d2abbc53c4737ff41476533047a
https://github.com/llvm/llvm-project/commit/7263e8e065e66d2abbc53c4737ff41476533047a
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2025-10-27 (Mon, 27 Oct 2025)
Changed paths:
M llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
M llvm/test/Transforms/LoopUnroll/followup.ll
Log Message:
-----------
[LoopUnroll][NFC] Clean up remainder followup metadata handling
Followup metadata for remainder loops is handled by two
implementations, both added by 7244852557ca6:
1. `tryToUnrollLoop` in `LoopUnrollPass.cpp`'.
2. `CloneLoopBlocks` in `LoopUnrollRuntime.cpp`.
As far as I can tell, 2 is useless: I added `assert(!NewLoopID)` for
the `NewLoopID` returned by the `makeFollowupLoopID` call, and it
never fails throughout check-all for my build.
Moreover, if 2 were useful, it appears it would have a bug caused by
7cd826a321d9. That commit skips adding loop metadata to a new
remainder loop if the remainder loop itself is to be completely
unrolled because it will then no longer be a loop. However, that
commit incorrectly assumes that `UnrollRemainder` dictates complete
unrolling of a remainder loop, and thus it skips adding loop metadata
even if the remainder loop will be only partially unrolled.
To avoid further confusion here, this patch removes 2. check-all
continues to pass for my build. If 2 actually is useful, please
advise so we can create a test that covers that usage.
Near 2, this patch retains the `UnrollRemainder` guard on the
`setLoopAlreadyUnrolled` call, which adds `llvm.loop.unroll.disable`
to the remainder loop. That behavior exists both before and after
7cd826a321d9. The logic appears to be that remainder loop unrolling
(whether complete or partial) is opt-in. That is, unless
`UnrollRemainder` is true, `UnrollRuntimeLoopRemainder` skips running
remainder loop unrolling, and `llvm.loop.unroll.disable` suppresses
any later attempt at it.
This patch also extends testing of remainder loop followup metadata to
be sure remainder loop partial unrolling is handled correctly by 1.
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