aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-09-15 21:03:06 +0000
committerBill Wendling <isanbard@gmail.com>2010-09-15 21:03:06 +0000
commit4ab405d84bd90aa6ffdbaf01c83cb8aa2fbe75f5 (patch)
tree1ccc9d5fabc91245ef769cca3cb79ba401cda806
parent42e23e97ba034899df01aec29080028450149743 (diff)
downloadllvm-4ab405d84bd90aa6ffdbaf01c83cb8aa2fbe75f5.zip
llvm-4ab405d84bd90aa6ffdbaf01c83cb8aa2fbe75f5.tar.gz
llvm-4ab405d84bd90aa6ffdbaf01c83cb8aa2fbe75f5.tar.bz2
Merge AutoUpgrade of EH magic variable.
$ svn merge -c 113600 https://llvm.org/svn/llvm-project/llvm/trunk --- Merging r113600 into '.': A test/Bitcode/AutoUpgradeGlobals.ll A test/Bitcode/AutoUpgradeGlobals.ll.bc U include/llvm/AutoUpgrade.h U lib/Bitcode/Reader/BitcodeReader.cpp U lib/VMCore/AutoUpgrade.cpp $ svn merge -c 113603 https://llvm.org/svn/llvm-project/llvm/trunk --- Merging r113603 into '.': G lib/VMCore/AutoUpgrade.cpp $ svn merge -c 113615 https://llvm.org/svn/llvm-project/llvm/trunk --- Merging r113615 into '.': G lib/VMCore/AutoUpgrade.cpp llvm-svn: 114020
-rw-r--r--llvm/include/llvm/AutoUpgrade.h5
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp6
-rw-r--r--llvm/lib/VMCore/AutoUpgrade.cpp12
-rw-r--r--llvm/test/Bitcode/AutoUpgradeGlobals.ll3
-rw-r--r--llvm/test/Bitcode/AutoUpgradeGlobals.ll.bcbin0 -> 312 bytes
5 files changed, 26 insertions, 0 deletions
diff --git a/llvm/include/llvm/AutoUpgrade.h b/llvm/include/llvm/AutoUpgrade.h
index 0a81c80795..5ce20b6 100644
--- a/llvm/include/llvm/AutoUpgrade.h
+++ b/llvm/include/llvm/AutoUpgrade.h
@@ -16,6 +16,7 @@
namespace llvm {
class Module;
+ class GlobalVariable;
class Function;
class CallInst;
@@ -35,6 +36,10 @@ namespace llvm {
/// so that it can update all calls to the old function.
void UpgradeCallsToIntrinsic(Function* F);
+ /// This checks for global variables which should be upgraded. It returns true
+ /// if it requires upgrading.
+ bool UpgradeGlobalVariable(GlobalVariable *GV);
+
/// This function checks debug info intrinsics. If an intrinsic is invalid
/// then this function simply removes the intrinsic.
void CheckDebugInfoIntrinsics(Module *M);
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index ee55ebb..830c79a 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1297,6 +1297,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/llvm/lib/VMCore/AutoUpgrade.cpp b/llvm/lib/VMCore/AutoUpgrade.cpp
index fd64460..9330e14 100644
--- a/llvm/lib/VMCore/AutoUpgrade.cpp
+++ b/llvm/lib/VMCore/AutoUpgrade.cpp
@@ -365,6 +365,18 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
return Upgraded;
}
+bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
+ StringRef Name(GV->getName());
+
+ // We are only upgrading one symbol here.
+ 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
diff --git a/llvm/test/Bitcode/AutoUpgradeGlobals.ll b/llvm/test/Bitcode/AutoUpgradeGlobals.ll
new file mode 100644
index 0000000..8a87673
--- /dev/null
+++ b/llvm/test/Bitcode/AutoUpgradeGlobals.ll
@@ -0,0 +1,3 @@
+; This isn't really an assembly file. It just runs test on bitcode to ensure
+; it is auto-upgraded.
+; RUN: llvm-dis < %s.bc | not grep {i32 @\\.llvm\\.eh}
diff --git a/llvm/test/Bitcode/AutoUpgradeGlobals.ll.bc b/llvm/test/Bitcode/AutoUpgradeGlobals.ll.bc
new file mode 100644
index 0000000..1abe968
--- /dev/null
+++ b/llvm/test/Bitcode/AutoUpgradeGlobals.ll.bc
Binary files differ