summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-05-16 20:39:27 +0000
committerReid Kleckner <reid@kleckner.net>2014-05-16 20:39:27 +0000
commitfceb76f5f9effc36da73a3ed3ea84b37daf45569 (patch)
treeec522e20f7588c225b746eb58ab3863b2b8ab4a6 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent41c73028887080eb61ef843db16fc188bcae6c5b (diff)
downloadbcm5719-llvm-fceb76f5f9effc36da73a3ed3ea84b37daf45569.tar.gz
bcm5719-llvm-fceb76f5f9effc36da73a3ed3ea84b37daf45569.zip
Add comdat key field to llvm.global_ctors and llvm.global_dtors
This allows us to put dynamic initializers for weak data into the same comdat group as the data being initialized. This is necessary for MSVC ABI compatibility. Once we have comdats for guard variables, we can use the combination to help GlobalOpt fire more often for weak data with guarded initialization on other platforms. Reviewers: nlewycky Differential Revision: http://reviews.llvm.org/D3499 llvm-svn: 209015
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 14546c0fe4c..a2bb52c1e9f 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1700,8 +1700,11 @@ error_code BitcodeReader::GlobalCleanup() {
// 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);
+ GI != GE;) {
+ GlobalVariable *GV = GI++;
+ UpgradeGlobalVariable(GV);
+ }
+
// Force deallocation of memory for these vectors to favor the client that
// want lazy deserialization.
std::vector<std::pair<GlobalVariable*, unsigned> >().swap(GlobalInits);
OpenPOWER on IntegriCloud