[all-commits] [llvm/llvm-project] 168173: [NFC][LoopPeel] Add tests for load widening
Guy David via All-commits
all-commits at lists.llvm.org
Tue Aug 4 10:46:10 PDT 2026
Branch: refs/heads/users/guy-david/loop-peel-widen-load
Home: https://github.com/llvm/llvm-project
Commit: 16817382e75e984bbe7cd2b9042660154e172477
https://github.com/llvm/llvm-project/commit/16817382e75e984bbe7cd2b9042660154e172477
Author: Guy David <guyda96 at gmail.com>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
A llvm/test/Transforms/LoopUnroll/AArch64/peel-last-iteration-load-widening-be.ll
A llvm/test/Transforms/LoopUnroll/AArch64/peel-last-iteration-load-widening.ll
Log Message:
-----------
[NFC][LoopPeel] Add tests for load widening
Commit: f134fb4196652c57ce721b7f9a54bd67b43f9a83
https://github.com/llvm/llvm-project/commit/f134fb4196652c57ce721b7f9a54bd67b43f9a83
Author: Guy David <guyda96 at gmail.com>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
M llvm/include/llvm/Analysis/TargetTransformInfo.h
M llvm/include/llvm/Transforms/Utils/LoopPeel.h
M llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
M llvm/lib/Transforms/Utils/LoopPeel.cpp
M llvm/test/Transforms/LoopUnroll/AArch64/peel-last-iteration-load-widening-be.ll
A llvm/test/Transforms/LoopUnroll/AArch64/peel-last-iteration-load-widening-disabled.ll
M llvm/test/Transforms/LoopUnroll/AArch64/peel-last-iteration-load-widening.ll
Log Message:
-----------
[LoopPeel] Peel last iteration to enable load widening
In loops that contain multiple consecutive small loads (e.g., 3 bytes
loading i8's), peeling the last iteration makes it safe to read beyond
the accessed region, enabling the use of a wider load (e.g., b32) for
all other N-1 iterations.
Patterns such as:
```
%a = load i8, ptr %p
%b = load i8, ptr %p+1
%c = load i8, ptr %p+2
...
%p.next = getelementptr i8, ptr %p, 3
```
Can be transformed to:
```
%wide = load b32, ptr %p ; Read 4 bytes
%frozen = freeze b32 %wide
%value = bitcast b32 %frozen to i32
%a = trunc
%b = lshr + trunc
%c = lshr + trunc
%p.next = getelementptr i8, ptr %p, 3
...
```
The wide load is of a byte type rather than an integer to handle poison
values correctly. Byte values carry poison per bit instead of per value,
so the read-ahead bytes, which the peel makes dereferenceable, cannot
taint the grouped bytes.
This acts as a fallback strategy when vectorization fails and has
significant performance uplifts, most notably in image processing
where processing an RGB buffer is common.
Assisted-by: Opus 4.8
Compare: https://github.com/llvm/llvm-project/compare/7830bbc86d61...f134fb419665
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