[PATCH] D49342: [LSV] Refactoring + supporting bitcasts to a type of different size

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 14 10:09:15 PDT 2018


rtereshin created this revision.
rtereshin added reviewers: volkan, arsenm, rampitec.
Herald added subscribers: javed.absar, nhaehnle, wdng.

This is mostly a preparation work for adding a limited support for `select` instructions.
It proved to be difficult to do due to size and irregularity of `Vectorizer::isConsecutiveAccess`,
this is fixed here I believe.

It also turned out that these changes make it simpler to finish one of the TODOs and fix a number of other small issues, namely:

1. Looking through bitcasts to a type of a different size (requires careful tracking of the original load/store size and some math converting sizes in bytes to expected differences in indices of GEPs).
2. Reusing partial analysis of pointers done by first attempt in proving them consecutive instead of starting from scratch. This added limited support for nested GEPs co-existing with difficult sext/zext instructions. This also required a careful handling of negative differences between constant parts of offsets.
3. Handing a case where the first pointer index is not an `add`, but something else (a function parameter for instance).
4. Handling a case where the sext/zext's operand is not `add %x, C`, but `add C, %x`, where C is a constant.

I observe an increased number of successful vectorizations on a large set of shader programs. Only few shaders are affected, but those that are affected sport >5% less loads and stores than before the patch.

The `select`s patch is coming soon.

This is related to but independent of https://reviews.llvm.org/D48853 ("[SCEV] Add zext(C + x + ...) -> D + zext(C-D + x + ...)<nuw> transform"), also improving `LoadStoreVectorizer`.


Repository:
  rL LLVM

https://reviews.llvm.org/D49342

Files:
  lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
  test/CodeGen/X86/loadStore_vectorizer.ll
  test/Transforms/LoadStoreVectorizer/AMDGPU/gep-bitcast.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49342.155558.patch
Type: text/x-patch
Size: 11168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180714/ad0d5c8d/attachment.bin>


More information about the llvm-commits mailing list