summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Globals.cpp7
-rw-r--r--lib/IR/Verifier.cpp1
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/IR/Globals.cpp b/lib/IR/Globals.cpp
index 76baa6202a..2265e4c2b7 100644
--- a/lib/IR/Globals.cpp
+++ b/lib/IR/Globals.cpp
@@ -63,6 +63,13 @@ void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
setDLLStorageClass(Src->getDLLStorageClass());
}
+unsigned GlobalValue::getAlignment() const {
+ if (auto *GA = dyn_cast<GlobalAlias>(this))
+ return GA->getAliasedGlobal()->getAlignment();
+
+ return (1u << Alignment) >> 1;
+}
+
void GlobalValue::setAlignment(unsigned Align) {
assert((!isa<GlobalAlias>(this)) &&
"GlobalAlias should not have an alignment!");
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 0bc5c509eb..bc378aed16 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -477,7 +477,6 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) {
"Alias and aliasee types should match!", &GA);
Assert1(!GA.hasUnnamedAddr(), "Alias cannot have unnamed_addr!", &GA);
Assert1(!GA.hasSection(), "Alias cannot have a section!", &GA);
- Assert1(!GA.getAlignment(), "Alias connot have an alignment", &GA);
const Constant *Aliasee = GA.getAliasee();
const GlobalValue *GV = dyn_cast<GlobalValue>(Aliasee);