Skip to content

Commit 4ab405d

Browse files
committed
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
1 parent 42e23e9 commit 4ab405d

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

llvm/include/llvm/AutoUpgrade.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
namespace llvm {
1818
class Module;
19+
class GlobalVariable;
1920
class Function;
2021
class CallInst;
2122

@@ -35,6 +36,10 @@ namespace llvm {
3536
/// so that it can update all calls to the old function.
3637
void UpgradeCallsToIntrinsic(Function* F);
3738

39+
/// This checks for global variables which should be upgraded. It returns true
40+
/// if it requires upgrading.
41+
bool UpgradeGlobalVariable(GlobalVariable *GV);
42+
3843
/// This function checks debug info intrinsics. If an intrinsic is invalid
3944
/// then this function simply removes the intrinsic.
4045
void CheckDebugInfoIntrinsics(Module *M);

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,12 @@ bool BitcodeReader::ParseModule() {
12971297
UpgradedIntrinsics.push_back(std::make_pair(FI, NewFn));
12981298
}
12991299

1300+
// Look for global variables which need to be renamed.
1301+
for (Module::global_iterator
1302+
GI = TheModule->global_begin(), GE = TheModule->global_end();
1303+
GI != GE; ++GI)
1304+
UpgradeGlobalVariable(GI);
1305+
13001306
// Force deallocation of memory for these vectors to favor the client that
13011307
// want lazy deserialization.
13021308
std::vector<std::pair<GlobalVariable*, unsigned> >().swap(GlobalInits);

llvm/lib/VMCore/AutoUpgrade.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,18 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
365365
return Upgraded;
366366
}
367367

368+
bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
369+
StringRef Name(GV->getName());
370+
371+
// We are only upgrading one symbol here.
372+
if (Name == ".llvm.eh.catch.all.value") {
373+
GV->setName("llvm.eh.catch.all.value");
374+
return true;
375+
}
376+
377+
return false;
378+
}
379+
368380
/// ExtendNEONArgs - For NEON "long" and "wide" operations, where the results
369381
/// have vector elements twice as big as one or both source operands, do the
370382
/// sign- or zero-extension that used to be handled by intrinsics. The
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
; This isn't really an assembly file. It just runs test on bitcode to ensure
2+
; it is auto-upgraded.
3+
; RUN: llvm-dis < %s.bc | not grep {i32 @\\.llvm\\.eh}
312 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)