summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/BasicBlockUtils.cpp7
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp21
2 files changed, 6 insertions, 22 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 076f89e3374..93764b6d1a2 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -78,9 +78,8 @@ void llvm::FoldSingleEntryPHINodes(BasicBlock *BB) {
/// DeleteDeadPHIs - Examine each PHI in the given block and delete it if it
/// is dead. Also recursively delete any operands that become dead as
/// a result. This includes tracing the def-use list from the PHI to see if
-/// it is ultimately unused or if it reaches an unused cycle. If a
-/// ValueDeletionListener is specified, it is notified of the deletions.
-void llvm::DeleteDeadPHIs(BasicBlock *BB, ValueDeletionListener *VDL) {
+/// it is ultimately unused or if it reaches an unused cycle.
+void llvm::DeleteDeadPHIs(BasicBlock *BB) {
// Recursively deleting a PHI may cause multiple PHIs to be deleted
// or RAUW'd undef, so use an array of WeakVH for the PHIs to delete.
SmallVector<WeakVH, 8> PHIs;
@@ -90,7 +89,7 @@ void llvm::DeleteDeadPHIs(BasicBlock *BB, ValueDeletionListener *VDL) {
for (unsigned i = 0, e = PHIs.size(); i != e; ++i)
if (PHINode *PN = dyn_cast_or_null<PHINode>(PHIs[i].operator Value*()))
- RecursivelyDeleteDeadPHINode(PN, VDL);
+ RecursivelyDeleteDeadPHINode(PN);
}
/// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor,
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 3b36362bb39..fea739cb46b 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -178,18 +178,10 @@ bool llvm::isInstructionTriviallyDead(Instruction *I) {
return false;
}
-/// ~ValueDeletionListener - A trivial dtor, defined out of line to give the
-/// class a home.
-llvm::ValueDeletionListener::~ValueDeletionListener() {}
-
/// RecursivelyDeleteTriviallyDeadInstructions - If the specified value is a
/// trivially dead instruction, delete it. If that makes any of its operands
/// trivially dead, delete them too, recursively.
-///
-/// If a ValueDeletionListener is specified, it is notified of instructions that
-/// are actually deleted (before they are actually deleted).
-void llvm::RecursivelyDeleteTriviallyDeadInstructions(Value *V,
- ValueDeletionListener *VDL) {
+void llvm::RecursivelyDeleteTriviallyDeadInstructions(Value *V) {
Instruction *I = dyn_cast<Instruction>(V);
if (!I || !I->use_empty() || !isInstructionTriviallyDead(I))
return;
@@ -201,10 +193,6 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(Value *V,
I = DeadInsts.back();
DeadInsts.pop_back();
- // If the client wanted to know, tell it about deleted instructions.
- if (VDL)
- VDL->ValueWillBeDeleted(I);
-
// Null out all of the instruction's operands to see if any operand becomes
// dead as we go.
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {
@@ -230,11 +218,8 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(Value *V,
/// either forms a cycle or is terminated by a trivially dead instruction,
/// delete it. If that makes any of its operands trivially dead, delete them
/// too, recursively.
-///
-/// If a ValueDeletionListener is specified, it is notified of instructions that
-/// are actually deleted (before they are actually deleted).
void
-llvm::RecursivelyDeleteDeadPHINode(PHINode *PN, ValueDeletionListener *VDL) {
+llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) {
// We can remove a PHI if it is on a cycle in the def-use graph
// where each node in the cycle has degree one, i.e. only one use,
@@ -253,7 +238,7 @@ llvm::RecursivelyDeleteDeadPHINode(PHINode *PN, ValueDeletionListener *VDL) {
if (!PHIs.insert(cast<PHINode>(JP))) {
// Break the cycle and delete the PHI and its operands.
JP->replaceAllUsesWith(UndefValue::get(JP->getType()));
- RecursivelyDeleteTriviallyDeadInstructions(JP, VDL);
+ RecursivelyDeleteTriviallyDeadInstructions(JP);
break;
}
}
OpenPOWER on IntegriCloud