summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2016-07-28 21:26:40 +0000
committerAlina Sbirlea <asbirlea@google.com>2016-07-28 21:26:40 +0000
commit7116eb6e16694c2d774e079a63b25fddb1b46c21 (patch)
treee0c76a81418b10988aeacb8f4878d5d60aa0db18
parent56fdf0d97e13c5e54ac93728e45d7061d7fe4996 (diff)
downloadbcm5719-llvm-7116eb6e16694c2d774e079a63b25fddb1b46c21.tar.gz
bcm5719-llvm-7116eb6e16694c2d774e079a63b25fddb1b46c21.zip
Remove TargetBaseAlign. Keep alignment for stack adjustments.
Summary: TargetBaseAlign is no longer required since LSV checks if target allows misaligned accesses. A constant defining a base alignment is still needed for stack accesses where alignment can be adjusted. Reviewers: llvm-commits, jlebar Subscribers: mzolotukhin, arsenm Differential Revision: https://reviews.llvm.org/D22936 llvm-svn: 277038
-rw-r--r--llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
index 0d6ae4c72fd..3c7657bc433 100644
--- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -40,9 +40,8 @@ STATISTIC(NumScalarsVectorized, "Number of scalar accesses vectorized");
namespace {
-// TODO: Remove this
-static const unsigned TargetBaseAlign = 4;
-
+// FIXME: Assuming stack alignment of 4 is always good enough
+static const unsigned StackAdjustedAlignment = 4;
typedef SmallVector<Instruction *, 8> InstrList;
typedef MapVector<Value *, InstrList> InstrListMap;
@@ -798,8 +797,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(TargetBaseAlign);
- Alignment = TargetBaseAlign;
+ AI->setAlignment(StackAdjustedAlignment);
+ Alignment = StackAdjustedAlignment;
} else {
return false;
}
@@ -948,8 +947,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(TargetBaseAlign);
- Alignment = TargetBaseAlign;
+ AI->setAlignment(StackAdjustedAlignment);
+ Alignment = StackAdjustedAlignment;
} else {
return false;
}
@@ -1029,10 +1028,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);
- // TODO: Remove TargetBaseAlign
- return !(Allows && Fast) && (Alignment % SzInBytes) != 0 &&
- (Alignment % TargetBaseAlign) != 0;
+ return !Allows || !Fast;
}
OpenPOWER on IntegriCloud