From e91197965086819410d51de46a556ff05cb9b625 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 17 Mar 2004 01:59:27 +0000 Subject: [PATCH] Be more accurate git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12464 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/GCSE.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index e949525d80d..c5d5a684e44 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/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(Second)) + ++NumLoadRemoved; // Keep track of loads eliminated + if (isa(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(Other)) + ++NumLoadRemoved; // Keep track of loads eliminated + if (isa(Other)) + ++NumCallRemoved; // Keep track of calls eliminated + ReplaceInstWithInst(I, Other); Ret = I; } else if (DomSetInfo->dominates(BB2, BB1)) { // Other dom I? + if (isa(I)) + ++NumLoadRemoved; // Keep track of loads eliminated + if (isa(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(Ret)) - ++NumLoadRemoved; // Keep track of loads eliminated - if (isa(Ret)) - ++NumCallRemoved; // Keep track of calls eliminated ++NumInstRemoved; // Keep track of number of instructions eliminated // Add all users of Ret to the worklist...