Re-commit r208025, reverted in r208030, with a fix for a conformance issue
which GCC detects and Clang does not!
llvm-svn: 208033
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
index 03b17d5..9decddc 100644
--- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
@@ -54,16 +54,16 @@
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 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) {