[PATCH] D147735: [LV] Adds simple analysis that improves VF-aware uniformity checks.
Vasileios Porpodas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 6 12:50:34 PDT 2023
vporpo created this revision.
vporpo added reviewers: fhahn, reames.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
vporpo requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.
This helps generate broadcasts instead of gathers in cases like:
for (i = 0; i != N; ++i)
... = ... B[i/4]
when VF is a multiple of 4.
And will generate a single store in cases like this:
for (i = 0; i != N; ++i)
A[i/4] = ...
when VF is a multiple of 4.
Without this patch the uniformity checks only test for loop-invariance, so they
return false for `i/4`, even though `i/4` will always return `i/4` for all
`i/4`, `(i+1)/4`, `(i+2)/4` and `(i+3)/4`.
This patch adds a simple analysis that checks if a value is a linear expression
of the induction variable divided by a constant and that the VF is a multiple
of this constant. If so, the value is treaded as uniform.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147735
Files:
llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/X86/uniform_across_vf.ll
llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
llvm/test/Transforms/LoopVectorize/pr47343-expander-lcssa-after-cfg-update.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147735.511507.patch
Type: text/x-patch
Size: 29129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230406/556f29ba/attachment.bin>
More information about the llvm-commits
mailing list