[llvm-commits] CVS: llvm/lib/VMCore/Globals.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Jul 18 01:13:08 PDT 2004
Changes in directory llvm/lib/VMCore:
Globals.cpp updated: 1.1 -> 1.2
---
Log message:
Fix infinite loop gccld'ing povray
---
Diffs of the changes: (+6 -8)
Index: llvm/lib/VMCore/Globals.cpp
diff -u llvm/lib/VMCore/Globals.cpp:1.1 llvm/lib/VMCore/Globals.cpp:1.2
--- llvm/lib/VMCore/Globals.cpp:1.1 Sat Jul 17 19:06:26 2004
+++ llvm/lib/VMCore/Globals.cpp Sun Jul 18 03:12:57 2004
@@ -17,7 +17,6 @@
#include "llvm/Module.h"
#include "llvm/SymbolTable.h"
#include "Support/LeakDetector.h"
-
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -28,21 +27,20 @@
/// there are no non-constant uses of this GlobalValue. If there aren't then
/// this and the transitive closure of the constants can be deleted. See the
/// destructor for details.
-namespace {
-bool removeDeadConstantUsers(Constant* C) {
- while (!C->use_empty()) {
+static bool removeDeadConstantUsers(Constant* C) {
+ if (isa<GlobalValue>(C)) return false; // Cannot remove this
+
+ while (!C->use_empty())
if (Constant *User = dyn_cast<Constant>(C->use_back())) {
if (!removeDeadConstantUsers(User))
return false; // Constant wasn't dead
} else {
return false; // Non-constant usage;
}
- }
- if (!isa<GlobalValue>(C))
- C->destroyConstant();
+
+ C->destroyConstant();
return true;
}
-}
/// removeDeadConstantUsers - If there are any dead constant users dangling
/// off of this global value, remove them. This method is useful for clients
More information about the llvm-commits
mailing list