summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
index 3c7657bc433..0d6ae4c72fd 100644
--- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -40,8 +40,9 @@ STATISTIC(NumScalarsVectorized, "Number of scalar accesses vectorized");
namespace {
-// FIXME: Assuming stack alignment of 4 is always good enough
-static const unsigned StackAdjustedAlignment = 4;
+// TODO: Remove this
+static const unsigned TargetBaseAlign = 4;
+
typedef SmallVector<Instruction *, 8> InstrList;
typedef MapVector<Value *, InstrList> InstrListMap;
@@ -797,8 +798,8 @@ bool Vectorizer::vectorizeStoreChain(
// so we can cheat and change it!
Value *V = GetUnderlyingObject(S0->getPointerOperand(), DL);
if (AllocaInst *AI = dyn_cast_or_null<AllocaInst>(V)) {
- AI->setAlignment(StackAdjustedAlignment);
- Alignment = StackAdjustedAlignment;
+ AI->setAlignment(TargetBaseAlign);
+ Alignment = TargetBaseAlign;
} else {
return false;
}
@@ -947,8 +948,8 @@ bool Vectorizer::vectorizeLoadChain(
// so we can cheat and change it!
Value *V = GetUnderlyingObject(L0->getPointerOperand(), DL);
if (AllocaInst *AI = dyn_cast_or_null<AllocaInst>(V)) {
- AI->setAlignment(StackAdjustedAlignment);
- Alignment = StackAdjustedAlignment;
+ AI->setAlignment(TargetBaseAlign);
+ Alignment = TargetBaseAlign;
} else {
return false;
}
@@ -1028,10 +1029,10 @@ bool Vectorizer::vectorizeLoadChain(
bool Vectorizer::accessIsMisaligned(unsigned SzInBytes, unsigned AddressSpace,
unsigned Alignment) {
- if (Alignment % SzInBytes == 0)
- return false;
bool Fast = false;
bool Allows = TTI.allowsMisalignedMemoryAccesses(SzInBytes * 8, AddressSpace,
Alignment, &Fast);
- return !Allows || !Fast;
+ // TODO: Remove TargetBaseAlign
+ return !(Allows && Fast) && (Alignment % SzInBytes) != 0 &&
+ (Alignment % TargetBaseAlign) != 0;
}
OpenPOWER on IntegriCloud