[PATCH] D51313: [LV] Fix code gen for conditionally executed uniform loads

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 27 09:19:19 PDT 2018


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

While working on https://reviews.llvm.org/D50665, I came across a latent bug in vectorizer which generates
incorrect code for uniform memory accesses that are executed conditionally.

This affects architectures that have masked gather/scatter support.
See added test case in X86. Without this patch, we were unconditionally
executing the load in the vectorized version. This can introduce a SEGFAULT
which never occurs in the scalar version.

The fix here is to avoid scalarizing of uniform loads that are executed
conditionally. On architectures with masked gather support, these loads
should use the masked gather instruction.


Repository:
  rL LLVM

https://reviews.llvm.org/D51313

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/X86/invariant-load-gather.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51313.162692.patch
Type: text/x-patch
Size: 6689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180827/428ac723/attachment.bin>


More information about the llvm-commits mailing list