[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GCSE.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 16 20:00:02 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

GCSE.cpp updated: 1.35 -> 1.36

---
Log message:

Be more accurate 


---
Diffs of the changes:  (+15 -4)

Index: llvm/lib/Transforms/Scalar/GCSE.cpp
diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.35 llvm/lib/Transforms/Scalar/GCSE.cpp:1.36
--- llvm/lib/Transforms/Scalar/GCSE.cpp:1.35	Sun Mar 14 23:46:59 2004
+++ llvm/lib/Transforms/Scalar/GCSE.cpp	Tue Mar 16 19:59:27 2004
@@ -223,6 +223,11 @@
     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 @@
     // 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 @@
     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...





More information about the llvm-commits mailing list