summaryrefslogtreecommitdiff
path: root/lib/Linker
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Linker')
-rw-r--r--lib/Linker/LinkModules.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index b742492da0..820f3acace 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -495,15 +495,15 @@ static void forceRenaming(GlobalValue *GV, StringRef Name) {
/// a GlobalValue) from the SrcGV to the DestGV.
static void copyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
// Use the maximum alignment, rather than just copying the alignment of SrcGV.
+ auto *DestGO = dyn_cast<GlobalObject>(DestGV);
unsigned Alignment;
- bool IsAlias = isa<GlobalAlias>(DestGV);
- if (!IsAlias)
- Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment());
+ if (DestGO)
+ Alignment = std::max(DestGO->getAlignment(), SrcGV->getAlignment());
DestGV->copyAttributesFrom(SrcGV);
- if (!IsAlias)
- DestGV->setAlignment(Alignment);
+ if (DestGO)
+ DestGO->setAlignment(Alignment);
forceRenaming(DestGV, SrcGV->getName());
}