aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp6
-rw-r--r--lib/VMCore/AutoUpgrade.cpp14
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 02b1fb0e6b..74b8e40a18 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1288,6 +1288,12 @@ bool BitcodeReader::ParseModule() {
UpgradedIntrinsics.push_back(std::make_pair(FI, NewFn));
}
+ // Look for global variables which need to be renamed.
+ for (Module::global_iterator
+ GI = TheModule->global_begin(), GE = TheModule->global_end();
+ GI != GE; ++GI)
+ UpgradeGlobalVariable(GI);
+
// Force deallocation of memory for these vectors to favor the client that
// want lazy deserialization.
std::vector<std::pair<GlobalVariable*, unsigned> >().swap(GlobalInits);
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp
index fd64460d6f..3908e8aed6 100644
--- a/lib/VMCore/AutoUpgrade.cpp
+++ b/lib/VMCore/AutoUpgrade.cpp
@@ -365,6 +365,20 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
return Upgraded;
}
+bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
+ const std::string &Name = GV->getName();
+
+ // We are only upgrading one symbol here. If we upgrade more, we will want to
+ // perform some sort of short-circuiting like in the
+ // "UpgradeIntrinsicFunction1" function.
+ if (Name == ".llvm.eh.catch.all.value") {
+ GV->setName("llvm.eh.catch.all.value");
+ return true;
+ }
+
+ return false;
+}
+
/// ExtendNEONArgs - For NEON "long" and "wide" operations, where the results
/// have vector elements twice as big as one or both source operands, do the
/// sign- or zero-extension that used to be handled by intrinsics. The