aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-05-04 22:30:44 +0000
committerDan Gohman <gohman@apple.com>2009-05-04 22:30:44 +0000
commit35738ac150afafe2359268d4b2169498c6c98c5f (patch)
treeac250e567776d377d07d242c1b9c94c2d04d6176 /lib/Transforms/Utils/Local.cpp
parentbf2176a00092540e18e8922487975cabefed8265 (diff)
downloadexternal_llvm-35738ac150afafe2359268d4b2169498c6c98c5f.zip
external_llvm-35738ac150afafe2359268d4b2169498c6c98c5f.tar.gz
external_llvm-35738ac150afafe2359268d4b2169498c6c98c5f.tar.bz2
Re-apply 70645, converting ScalarEvolution to use
CallbackVH, with fixes. allUsesReplacedWith need to walk the def-use chains and invalidate all users of a value that is replaced. SCEVs of users need to be recalcualted even if the new value is equivalent. Also, make forgetLoopPHIs walk def-use chains, since any SCEV that depends on a PHI should be recalculated when more information about that PHI becomes available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70927 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/Local.cpp')
-rw-r--r--lib/Transforms/Utils/Local.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index 3b36362..fea739c 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/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;
}
}