diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-06 01:44:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-06 01:44:26 +0000 |
commit | 36ecb2ee9d5cfd001383d7cf7751d830f7c579d1 (patch) | |
tree | a25c18ded5389f992f8323ffb39e2160fee7e1a9 /lib/Transforms/IPO | |
parent | f3a199b2aec6071529f902a3c5d07556c46a8ae1 (diff) | |
download | llvm-36ecb2ee9d5cfd001383d7cf7751d830f7c579d1.tar.gz llvm-36ecb2ee9d5cfd001383d7cf7751d830f7c579d1.tar.bz2 llvm-36ecb2ee9d5cfd001383d7cf7751d830f7c579d1.tar.xz |
Re-commit r208025, reverted in r208030, with a fix for a conformance issue
which GCC detects and Clang does not!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/GlobalDCE.cpp | 6 | ||||
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index 03b17d5238..9decddcff8 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -54,16 +54,16 @@ namespace { bool RemoveUnusedGlobalValue(GlobalValue &GV); }; +} /// Returns true if F contains only a single "ret" instruction. -bool isEmptyFunction(void *Context, Function *F) { +static bool isEmptyFunction(Function *F) { BasicBlock &Entry = F->getEntryBlock(); if (Entry.size() != 1 || !isa<ReturnInst>(Entry.front())) return false; ReturnInst &RI = cast<ReturnInst>(Entry.front()); return RI.getReturnValue() == NULL; } -} char GlobalDCE::ID = 0; INITIALIZE_PASS(GlobalDCE, "globaldce", @@ -75,7 +75,7 @@ bool GlobalDCE::runOnModule(Module &M) { bool Changed = false; // Remove empty functions from the global ctors list. - Changed |= optimizeGlobalCtorsList(M, isEmptyFunction, nullptr); + Changed |= optimizeGlobalCtorsList(M, isEmptyFunction); // Loop over the module, adding globals which are obviously necessary. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 3db0abf89f..a8471bacb4 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -3022,10 +3022,9 @@ bool GlobalOpt::runOnModule(Module &M) { LocalChange |= OptimizeFunctions(M); // Optimize global_ctors list. - LocalChange |= optimizeGlobalCtorsList(M, [](void *C, Function *F) -> bool { - GlobalOpt *self = static_cast<GlobalOpt *>(C); - return EvaluateStaticConstructor(F, self->DL, self->TLI); - }, this); + LocalChange |= optimizeGlobalCtorsList(M, [&](Function *F) { + return EvaluateStaticConstructor(F, DL, TLI); + }); // Optimize non-address-taken globals. LocalChange |= OptimizeGlobalVars(M); |