diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-18 07:22:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-18 07:22:58 +0000 |
commit | 25c6d68029dc0e45dce5f6aa08c5e868b8a923fa (patch) | |
tree | 290c09c57ff97cbf60b44e9bce39f684c54f5277 /lib/Transforms | |
parent | 5827aebe64e442241fd16ef7006433251d060738 (diff) |
Remove useless statistic, fix some slightly broken logic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/GlobalDCE.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index c13a99853e..e025813fd0 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -26,7 +26,6 @@ using namespace llvm; namespace { Statistic<> NumFunctions("globaldce","Number of functions removed"); Statistic<> NumVariables("globaldce","Number of global variables removed"); - Statistic<> NumGVs("globaldce", "Number of global values removed"); struct GlobalDCE : public Pass { // run - Do the GlobalDCE pass on the specified module, optionally updating @@ -171,13 +170,10 @@ void GlobalDCE::MarkUsedGlobalsAsNeeded(Constant *C) { // might make it deader. // bool GlobalDCE::RemoveUnusedGlobalValue(GlobalValue &GV) { - for (Value::use_iterator I = GV.use_begin(), E = GV.use_end(); I != E; ++I) - if (GlobalValue* User = dyn_cast<GlobalValue>(*I)) - if (User->removeDeadConstantUsers()) { // Only if unreferenced... - ++NumGVs; - } - return false; - } + if (GV.use_empty()) return false; + GV.removeDeadConstantUsers(); + return GV.use_empty(); +} // SafeToDestroyConstant - It is safe to destroy a constant iff it is only used // by constants itself. Note that constants cannot be cyclic, so this test is |