[llvm-commits] CVS: llvm/lib/Analysis/LoadValueNumbering.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 28 22:21:10 PST 2005



Changes in directory llvm/lib/Analysis:

LoadValueNumbering.cpp updated: 1.25 -> 1.26
---
Log message:

Minor simplification/speedup.  Replaces a set lookup with a pointer comparison.
This speeds up 176.gcc from 25.73s to 23.48s, which is 9.5%


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

 LoadValueNumbering.cpp |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)


Index: llvm/lib/Analysis/LoadValueNumbering.cpp
diff -u llvm/lib/Analysis/LoadValueNumbering.cpp:1.25 llvm/lib/Analysis/LoadValueNumbering.cpp:1.26
--- llvm/lib/Analysis/LoadValueNumbering.cpp:1.25	Sat Jan 29 00:11:16 2005
+++ llvm/lib/Analysis/LoadValueNumbering.cpp	Sat Jan 29 00:20:55 2005
@@ -285,7 +285,6 @@
     return getAnalysis<ValueNumbering>().getEqualNumberNodes(V, RetVals);
   
   Value *PointerSource = LI->getOperand(0);
-  
   BasicBlock *LoadBB = LI->getParent();
   Function *F = LoadBB->getParent();
   
@@ -333,7 +332,7 @@
     // If this instruction is a candidate load before LI, we know there are no
     // invalidating instructions between it and LI, so they have the same value
     // number.
-    if (isa<LoadInst>(I) && Instrs.count(I)) {
+    if (isa<LoadInst>(I) && cast<LoadInst>(I)->getOperand(0) == PointerSource) {
       RetVals.push_back(I);
       Instrs.erase(I);
     } else if (AllocationInst *AI = dyn_cast<AllocationInst>(I)) {
@@ -350,7 +349,7 @@
       // If the invalidating instruction is a store, and its in our candidate
       // set, then we can do store-load forwarding: the load has the same value
       // # as the stored value.
-      if (isa<StoreInst>(I) && Instrs.count(I)) {
+      if (isa<StoreInst>(I) && I->getOperand(1) == PointerSource) {
         Instrs.erase(I);
         RetVals.push_back(I->getOperand(0));
       }
@@ -368,7 +367,7 @@
   for (BasicBlock::iterator I = LI->getNext(); I != LoadBB->end(); ++I) {
     // If this instruction is a load, then this instruction returns the same
     // value as LI.
-    if (isa<LoadInst>(I) && Instrs.count(I)) {
+    if (isa<LoadInst>(I) && cast<LoadInst>(I)->getOperand(0) == PointerSource) {
       RetVals.push_back(I);
       Instrs.erase(I);
     }






More information about the llvm-commits mailing list