[PATCH] D148841: [LV] Use SCEV for uniformity analysis across VF

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 14:02:40 PDT 2023


fhahn created this revision.
Herald added subscribers: StephenFan, javed.absar, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.

This patch uses SCEV to check if a value is uniform across a given VF.

The basic idea is to construct SCEVs where the AddRecs of the loop are
adjusted to reflect the version in the vectorized loop (Step multiplied
by VF). We construct a SCEV for the value of the first vector lane
(offset 0) and one for the last vector lane (VF - 1). If they are equal,
consider the expression uniform.

While re-writing expressions, we also need to catch expressions we
cannot determine uniformity (e.g. SCEVUnknown).

I might be missing something that makes this approach unworkable in
practice, but it may be an alternative to D147735 <https://reviews.llvm.org/D147735>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148841

Files:
  llvm/include/llvm/Analysis/LoopAccessAnalysis.h
  llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  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: D148841.515474.patch
Type: text/x-patch
Size: 33650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/cb61dead/attachment-0001.bin>


More information about the llvm-commits mailing list