summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2018-09-06 08:42:17 +0000
committerDavid Green <david.green@arm.com>2018-09-06 08:42:17 +0000
commite6918ca2b32269faa7629c9cd2786a7748f0ba58 (patch)
tree8e07522731a98f4c490b1d3705e7c7836453ad99 /llvm/lib/IR
parent8a9e059e5c593107cc007f04865b54131fe14545 (diff)
downloadbcm5719-llvm-e6918ca2b32269faa7629c9cd2786a7748f0ba58.tar.gz
bcm5719-llvm-e6918ca2b32269faa7629c9cd2786a7748f0ba58.zip
[SLC] Add an alignment to CreateGlobalString
Previously the alignment on the newly created global strings was not set, meaning that DataLayout::getPreferredAlignment was free to overalign it to 16 bytes. This caused unnecessary code bloat with the padding between variables. The main example of this happening was the printf->puts optimisation in SimplifyLibCalls, but as the change here is made in IRBuilderBase::CreateGlobalString, other globals using this will now be aligned too. Differential Revision: https://reviews.llvm.org/D51410 llvm-svn: 341527
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/IRBuilder.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index 405a56bfb31..91c950da71b 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -50,6 +50,7 @@ GlobalVariable *IRBuilderBase::CreateGlobalString(StringRef Str,
nullptr, GlobalVariable::NotThreadLocal,
AddressSpace);
GV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
+ GV->setAlignment(1);
return GV;
}
OpenPOWER on IntegriCloud