summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2018-09-28 20:21:51 +0000
committerEli Friedman <efriedma@codeaurora.org>2018-09-28 20:21:51 +0000
commitbb993be56bb38e46c029b682f67fd1b7dc4b9111 (patch)
tree162f6e76725f729cea3d11655706e9c73de44414 /llvm/lib/Target/ARM
parentb62f73420b91a430e68f60fee350e2a603d91d6f (diff)
downloadbcm5719-llvm-bb993be56bb38e46c029b682f67fd1b7dc4b9111.tar.gz
bcm5719-llvm-bb993be56bb38e46c029b682f67fd1b7dc4b9111.zip
[ARM] Use preferred alignment for constants in promoteToConstantPool.
This mostly affects IR generated by non-clang frontends because clang generally sets the alignment of globals explicitly. Fixes https://bugs.llvm.org//show_bug.cgi?id=32394 . (-arm-promote-constant is currently off by default, and it stays off with this patch. I'll look into turning it on again when all the known issues are fixed.) Differential Revision: https://reviews.llvm.org/D51469 llvm-svn: 343359
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 16111557650..15b64ef1173 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -3148,7 +3148,7 @@ static SDValue promoteToConstantPool(const GlobalValue *GV, SelectionDAG &DAG,
// that are strings for simplicity.
auto *CDAInit = dyn_cast<ConstantDataArray>(Init);
unsigned Size = DAG.getDataLayout().getTypeAllocSize(Init->getType());
- unsigned Align = GVar->getAlignment();
+ unsigned Align = DAG.getDataLayout().getPreferredAlignment(GVar);
unsigned RequiredPadding = 4 - (Size % 4);
bool PaddingPossible =
RequiredPadding == 4 || (CDAInit && CDAInit->isString());
OpenPOWER on IntegriCloud