summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Globals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Globals.cpp')
-rw-r--r--llvm/lib/IR/Globals.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index a6cd03e622a..0b49350e551 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -53,15 +53,18 @@ void GlobalValue::destroyConstant() {
/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a GlobalValue) from the GlobalValue Src to this one.
void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
- setAlignment(Src->getAlignment());
- setSection(Src->getSection());
+ if (!isa<GlobalAlias>(this)) {
+ setAlignment(Src->getAlignment());
+ setSection(Src->getSection());
+ }
+
setVisibility(Src->getVisibility());
setUnnamedAddr(Src->hasUnnamedAddr());
setDLLStorageClass(Src->getDLLStorageClass());
}
void GlobalValue::setAlignment(unsigned Align) {
- assert((!isa<GlobalAlias>(this) || !Align) &&
+ assert((!isa<GlobalAlias>(this)) &&
"GlobalAlias should not have an alignment!");
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
assert(Align <= MaximumAlignment &&
OpenPOWER on IntegriCloud