[PATCH] D124218: [LoadStoreVectorizer] Consider if operation is faster than before
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 25 09:58:13 PDT 2022
rampitec updated this revision to Diff 424951.
rampitec added a comment.
Rebased.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124218/new/
https://reviews.llvm.org/D124218
Files:
llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
Index: llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -187,7 +187,7 @@
/// Check if this load/store access is misaligned accesses.
bool accessIsMisaligned(unsigned SzInBytes, unsigned AddressSpace,
- Align Alignment);
+ Align Alignment, unsigned &Fast);
};
class LoadStoreVectorizerLegacyPass : public FunctionPass {
@@ -1078,8 +1078,14 @@
InstructionsProcessed->insert(Chain.begin(), Chain.end());
// If the store is going to be misaligned, don't vectorize it.
- if (accessIsMisaligned(SzInBytes, AS, Alignment)) {
+ unsigned Fast;
+ if (accessIsMisaligned(SzInBytes, AS, Alignment, Fast)) {
if (S0->getPointerAddressSpace() != DL.getAllocaAddrSpace()) {
+ unsigned FastBefore;
+ accessIsMisaligned(EltSzInBytes, AS, Alignment, FastBefore);
+ if (FastBefore > Fast)
+ return false;
+
auto Chains = splitOddVectorElts(Chain, Sz);
bool Vectorized = false;
Vectorized |= vectorizeStoreChain(Chains.first, InstructionsProcessed);
@@ -1231,8 +1237,14 @@
InstructionsProcessed->insert(Chain.begin(), Chain.end());
// If the load is going to be misaligned, don't vectorize it.
- if (accessIsMisaligned(SzInBytes, AS, Alignment)) {
+ unsigned Fast;
+ if (accessIsMisaligned(SzInBytes, AS, Alignment, Fast)) {
if (L0->getPointerAddressSpace() != DL.getAllocaAddrSpace()) {
+ unsigned FastBefore;
+ accessIsMisaligned(EltSzInBytes, AS, Alignment, FastBefore);
+ if (FastBefore > Fast)
+ return false;
+
auto Chains = splitOddVectorElts(Chain, Sz);
bool Vectorized = false;
Vectorized |= vectorizeLoadChain(Chains.first, InstructionsProcessed);
@@ -1316,7 +1328,8 @@
}
bool Vectorizer::accessIsMisaligned(unsigned SzInBytes, unsigned AddressSpace,
- Align Alignment) {
+ Align Alignment, unsigned &Fast) {
+ Fast = 0;
if (Alignment.value() % SzInBytes == 0)
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124218.424951.patch
Type: text/x-patch
Size: 2221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220425/5982772e/attachment.bin>
More information about the llvm-commits
mailing list