[PATCH] D22936: Remove TargetBaseAlign. Keep alignment for stack adjustments.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 28 14:05:53 PDT 2016
asbirlea created this revision.
asbirlea added reviewers: llvm-commits, jlebar.
asbirlea added a subscriber: arsenm.
Herald added a subscriber: mzolotukhin.
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.
https://reviews.llvm.org/D22936
Files:
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
Index: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -40,9 +40,7 @@
namespace {
-// TODO: Remove this
-static const unsigned TargetBaseAlign = 4;
-
+static const unsigned StackAdjustedAlignment = 4;
typedef SmallVector<Instruction *, 8> InstrList;
typedef MapVector<Value *, InstrList> InstrListMap;
@@ -798,8 +796,8 @@
// 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 +946,8 @@
// 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;
}
@@ -1032,7 +1030,5 @@
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) && (Alignment % SzInBytes) != 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22936.65992.patch
Type: text/x-patch
Size: 1689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160728/e1b30032/attachment.bin>
More information about the llvm-commits
mailing list