summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-17 01:59:27 +0000
committerChris Lattner <sabre@nondot.org>2004-03-17 01:59:27 +0000
commit684fa5ac64a63a5990040e07e941e6191d809574 (patch)
treeab20213b798f23034f07dd7c9cd0bfd690fe336d
parent10a8d735c83658e26eb9514cddff7a4624019a6a (diff)
downloadbcm5719-llvm-684fa5ac64a63a5990040e07e941e6191d809574.tar.gz
bcm5719-llvm-684fa5ac64a63a5990040e07e941e6191d809574.zip
Be more accurate
llvm-svn: 12464
-rw-r--r--llvm/lib/Transforms/Scalar/GCSE.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/GCSE.cpp b/llvm/lib/Transforms/Scalar/GCSE.cpp
index e949525d80d..c5d5a684e44 100644
--- a/llvm/lib/Transforms/Scalar/GCSE.cpp
+++ b/llvm/lib/Transforms/Scalar/GCSE.cpp
@@ -223,6 +223,11 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) {
Instruction *Second = I != First ? I : Other; // Get iterator to second inst
BI = Second;
+ if (isa<LoadInst>(Second))
+ ++NumLoadRemoved; // Keep track of loads eliminated
+ if (isa<CallInst>(Second))
+ ++NumCallRemoved; // Keep track of calls eliminated
+
// Destroy Second, using First instead.
ReplaceInstWithInst(First, BI);
Ret = First;
@@ -231,9 +236,19 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) {
// dominates the other instruction, we can simply use it
//
} else if (DomSetInfo->dominates(BB1, BB2)) { // I dom Other?
+ if (isa<LoadInst>(Other))
+ ++NumLoadRemoved; // Keep track of loads eliminated
+ if (isa<CallInst>(Other))
+ ++NumCallRemoved; // Keep track of calls eliminated
+
ReplaceInstWithInst(I, Other);
Ret = I;
} else if (DomSetInfo->dominates(BB2, BB1)) { // Other dom I?
+ if (isa<LoadInst>(I))
+ ++NumLoadRemoved; // Keep track of loads eliminated
+ if (isa<CallInst>(I))
+ ++NumCallRemoved; // Keep track of calls eliminated
+
ReplaceInstWithInst(Other, I);
Ret = Other;
} else {
@@ -266,10 +281,6 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) {
return 0;
}
- if (isa<LoadInst>(Ret))
- ++NumLoadRemoved; // Keep track of loads eliminated
- if (isa<CallInst>(Ret))
- ++NumCallRemoved; // Keep track of calls eliminated
++NumInstRemoved; // Keep track of number of instructions eliminated
// Add all users of Ret to the worklist...
OpenPOWER on IntegriCloud