diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2015-04-21 17:27:59 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2015-04-21 17:27:59 +0000 |
commit | 46084383868b63daf87f1dabdc6e09a39e2ff077 (patch) | |
tree | 12eb47fab552e316d1ab37b3802a0603a065f0b0 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | b63f779be4b076e530f9d2f79cdb1d09925356b5 (diff) | |
download | bcm5719-llvm-46084383868b63daf87f1dabdc6e09a39e2ff077.tar.gz bcm5719-llvm-46084383868b63daf87f1dabdc6e09a39e2ff077.zip |
Provide alignment info on LLVM external symbols
Code in CodeGenModule::GetOrCreateLLVMGlobal that sets up GlobalValue
object for LLVM external symbols has this comment:
// FIXME: This code is overly simple and should be merged with other global
// handling.
One part does seems to be "overly simple" currently is that this code
never sets any alignment info on the GlobalValue, so that the emitted
IR does not have any align attribute on external globals. This can
lead to unnecessarily inefficient code generation.
This patch adds a GV->setAlignment call to set alignment info.
llvm-svn: 235396
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 17b7ddc7683..b30885d4cdb 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1777,6 +1777,8 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, // handling. GV->setConstant(isTypeConstant(D->getType(), false)); + GV->setAlignment(getContext().getDeclAlign(D).getQuantity()); + setLinkageAndVisibilityForGV(GV, D); if (D->getTLSKind()) { |