[llvm] d222322 - [LoadStoreVectorizer] Optimize check for IsAllocaAccess. NFC
Bjorn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 12:43:58 PDT 2023
Author: Bjorn Pettersson
Date: 2023-06-09T21:43:42+02:00
New Revision: d2223221e7e8b76df16ad427450f3b4c98382ce7
URL: https://github.com/llvm/llvm-project/commit/d2223221e7e8b76df16ad427450f3b4c98382ce7
DIFF: https://github.com/llvm/llvm-project/commit/d2223221e7e8b76df16ad427450f3b4c98382ce7.diff
LOG: [LoadStoreVectorizer] Optimize check for IsAllocaAccess. NFC
Swap order for checking address space and the strip pointer cast
when analyzing if a load/store is accessing an alloca. This to
make sure we do the cheaper check first.
This is done as a follow up to D152386.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
index 4ee2dc56f5c83..260d7889906b2 100644
--- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -802,11 +802,12 @@ std::vector<Chain> Vectorizer::splitChainByAlignment(Chain &C) {
// FIXME: We will upgrade the alignment of the alloca even if it turns out
// we can't vectorize for some other reason.
Value *PtrOperand = getLoadStorePointerOperand(C[CBegin].Inst);
- bool IsAllocaAccess = isa<AllocaInst>(PtrOperand->stripPointerCasts());
+ bool IsAllocaAccess = AS == DL.getAllocaAddrSpace() &&
+ isa<AllocaInst>(PtrOperand->stripPointerCasts());
Align Alignment = getLoadStoreAlignment(C[CBegin].Inst);
Align PrefAlign = Align(StackAdjustedAlignment);
- if (IsAllocaAccess && AS == DL.getAllocaAddrSpace() &&
- Alignment.value() % SizeBytes != 0 && IsAllowedAndFast(PrefAlign)) {
+ if (IsAllocaAccess && Alignment.value() % SizeBytes != 0 &&
+ IsAllowedAndFast(PrefAlign)) {
Align NewAlign = getOrEnforceKnownAlignment(
PtrOperand, PrefAlign, DL, C[CBegin].Inst, nullptr, &DT);
if (NewAlign >= Alignment) {
More information about the llvm-commits
mailing list