mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
Remove an unused function SafeToDestroyConstant(). Rename an almost
identical function ConstantIsDead() to SafeToDestroyConstant(), to emphasise the connection with Constant::destroyConstant(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -47,7 +47,6 @@ namespace {
|
||||
void GlobalIsNeeded(GlobalValue *GV);
|
||||
void MarkUsedGlobalsAsNeeded(Constant *C);
|
||||
|
||||
bool SafeToDestroyConstant(Constant* C);
|
||||
bool RemoveUnusedGlobalValue(GlobalValue &GV);
|
||||
};
|
||||
}
|
||||
@@ -211,17 +210,3 @@ bool GlobalDCE::RemoveUnusedGlobalValue(GlobalValue &GV) {
|
||||
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
|
||||
// pretty easy to implement recursively.
|
||||
//
|
||||
bool GlobalDCE::SafeToDestroyConstant(Constant *C) {
|
||||
for (Value::use_iterator I = C->use_begin(), E = C->use_end(); I != E; ++I)
|
||||
if (Constant *User = dyn_cast<Constant>(*I)) {
|
||||
if (!SafeToDestroyConstant(User)) return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user