[PATCH] D91451: [LoopVectorizer] Leverage uniformity across unrolled iterations

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 11:35:33 PST 2020


reames created this revision.
reames added reviewers: anna, fhahn, greened.
Herald added subscribers: dantrushin, rogfer01, bollu, hiraditya, mcrosier.
Herald added a project: LLVM.
reames requested review of this revision.
Herald added a subscriber: vkmr.

(Note, this extends D91398 <https://reviews.llvm.org/D91398> and probably won't make any sense unless you've looked at that first.)

When scalarizing a uniform expression, we currently only consider uniformity within a single vector factor.  For some expressions, we can exploit the fact that the expression is uniform across all lanes of all vector factors in the unrolling.  This patch teaches the VPReplicateRecipe how to achieve this.

After this patch (and the previous one), we can lower a load from a loop invariant address as a single scalar load.  (Instead of UF*VF scalar loads and rely on CSE cleaning it up later.)

I'd hoped to exercise this through code paths not involving uniform mem ops, but the cases I tried were mostly covered by existing scalarization logic.  I believe this will sometimes trigger with existing code, but have struggled to find a clean example so I made the patch dependent on the uniform memory op work.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91451

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h
  llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91451.305221.patch
Type: text/x-patch
Size: 22933 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201113/d7842bb5/attachment.bin>


More information about the llvm-commits mailing list