[llvm] [VPlan] Add transformation to narrow interleave groups. (PR #106441)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 17:01:28 PST 2025
https://github.com/ayalz commented:
Post-approval review.
This patch does more than "narrow interleave groups" - it narrows the entire vector loop, including all its interleave groups.
The pattern handled is that of the reported
```
for (int i=0; i<n; i++) {
for (int k=0; k<4; k++) data[4*i+k] *= factor[i];
}
```
where * can be any binary operation. I.e., a full consecutive interleaved stored fed by a matching interleaved load (not necessarily from same base address) multiplied by a common consecutive factor.
The only cross-iteration dependence allowed, and required, is a canonical IV; should live-outs also be forbidden?
A more basic pattern to start with may be `data_out[4*i+k] = data_in[4*i+k]`. I.e., matching pairs of IG's. Every such pair can be optimized standalone by removing the shuffles of both IG's, leaving a wide load feeding a wide store. Then, if all IG's in the loop have been thus transformed, plus other conditions, the loop itself can be considered for narrowing. Makes sense?
https://github.com/llvm/llvm-project/pull/106441
More information about the llvm-commits
mailing list