diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-06 22:44:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-06 22:44:30 +0000 |
commit | 8d8f100c57f8c6e774c6948ecc9a6b6a34339e9e (patch) | |
tree | 41f07905790b8118b10c6c5cc475d69ddd11db0e /llvm/lib | |
parent | 0c4833f07ed4ce1574aff88698c469ddc3f6b1a3 (diff) | |
download | bcm5719-llvm-8d8f100c57f8c6e774c6948ecc9a6b6a34339e9e.tar.gz bcm5719-llvm-8d8f100c57f8c6e774c6948ecc9a6b6a34339e9e.zip |
Special case aliases in GlobalValue::getSection.
This is similar to the getAlignment patch, but is done just for
completeness. It looks like we never call getSection on an alias. All the
tests still pass if the if is replaced with an assert.
llvm-svn: 208139
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Globals.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 2265e4c2b72..f97602015f1 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -80,6 +80,12 @@ void GlobalValue::setAlignment(unsigned Align) { assert(getAlignment() == Align && "Alignment representation error!"); } +const std::string &GlobalValue::getSection() const { + if (auto *GA = dyn_cast<GlobalAlias>(this)) + return GA->getAliasedGlobal()->getSection(); + return Section; +} + void GlobalValue::setSection(StringRef S) { assert(!isa<GlobalAlias>(this) && "GlobalAlias should not have a section!"); Section = S; diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index bc378aed16b..083f7b5255e 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -476,7 +476,6 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) { Assert1(GA.getType() == GA.getAliasee()->getType(), "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); const Constant *Aliasee = GA.getAliasee(); const GlobalValue *GV = dyn_cast<GlobalValue>(Aliasee); |