[PATCH] D54538: [LV] Avoid vectorizing unsafe dependencies in uniform address

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 12:43:23 PST 2018


anna created this revision.
anna added reviewers: Ayal, efriedma.
Herald added a subscriber: rkruppe.

Currently, when vectorizing stores to uniform addresses, the only
instance we prevent vectorization is if there are multiple stores to the
same uniform address.
This patch teaches LAA to avoid vectorizing loops that have an unsafe
cross-iteration dependency between a load and a store to the same uniform address.
We cannot vectorize loops that load from a uniform address where in the
previous iteration we stored to the same uniform address.

Two test cases are added to show safe and unsafe dependencies for
vectorization. Fixes PR39653.

Note: Initially tried setting CanVecMem to false and returning from the
LAA analysis, when we came across unsafe dependencies. However, this
broke some tests in LoopVersioningLICM. So, the patch changes the
HasMultipleStoresToInvariantAddress to
HasNonVectorizableStoresToInvariantAddress. This allows ORE to
state the reason we could not vectorize the loop.


Repository:
  rL LLVM

https://reviews.llvm.org/D54538

Files:
  include/llvm/Analysis/LoopAccessAnalysis.h
  lib/Analysis/LoopAccessAnalysis.cpp
  lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  test/Analysis/LoopAccessAnalysis/memcheck-wrapping-pointers.ll
  test/Analysis/LoopAccessAnalysis/store-to-invariant-check1.ll
  test/Analysis/LoopAccessAnalysis/store-to-invariant-check2.ll
  test/Analysis/LoopAccessAnalysis/store-to-invariant-check3.ll
  test/Transforms/LoopVectorize/invariant-store-vectorization.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54538.174086.patch
Type: text/x-patch
Size: 14309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181114/1bcc984d/attachment.bin>


More information about the llvm-commits mailing list