[llvm-commits] [llvm] r41641 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp

Evan Cheng evan.cheng at apple.com
Fri Aug 31 01:26:44 PDT 2007


Author: evancheng
Date: Fri Aug 31 03:26:44 2007
New Revision: 41641

URL: http://llvm.org/viewvc/llvm-project?rev=41641&view=rev
Log:
Remove an unnecessary element, saving 4 bytes per LiveInterval.

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveInterval.h
    llvm/trunk/lib/CodeGen/LiveInterval.cpp

Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=41641&r1=41640&r2=41641&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Fri Aug 31 03:26:44 2007
@@ -106,12 +106,11 @@
     unsigned preference; // preferred register to allocate for this interval
     float weight;        // weight of this interval
     Ranges ranges;       // the ranges in which this register is live
-    unsigned numvals;    // number of value#'s
     VNInfoList valnos;   // value#'s
 
   public:
     LiveInterval(unsigned Reg, float Weight)
-      : reg(Reg), preference(0), weight(Weight), numvals(0) {
+      : reg(Reg), preference(0), weight(Weight) {
     }
 
     typedef Ranges::iterator iterator;
@@ -151,9 +150,9 @@
       return I;
     }
 
-    bool containsOneValue() const { return numvals == 1; }
+    bool containsOneValue() const { return valnos.size() == 1; }
 
-    unsigned getNumValNums() const { return numvals; }
+    unsigned getNumValNums() const { return valnos.size(); }
     
     /// getFirstValNumInfo - Returns pointer to the first val#.
     ///
@@ -175,7 +174,7 @@
     /// getNextValue - Create a new value number and return it.  MIIdx specifies
     /// the instruction that defines the value number.
     VNInfo *getNextValue(unsigned MIIdx, unsigned SrcReg) {
-      VNInfo *VNI = new VNInfo(this, numvals++, MIIdx, SrcReg);
+      VNInfo *VNI = new VNInfo(this, valnos.size(), MIIdx, SrcReg);
       valnos.push_back(VNI);
       return VNI;
     }

Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=41641&r1=41640&r2=41641&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Fri Aug 31 03:26:44 2007
@@ -349,13 +349,11 @@
   // Update val# info. Renumber them and make sure they all belong to this
   // LiveInterval now.
   valnos.clear();
-  numvals = 0;
   for (unsigned i = 0, e = NewVNInfo.size(); i != e; ++i) {
     VNInfo *VNI = NewVNInfo[i];
     VNI->parent = this;
     VNI->id = i;  // Renumber val#.
     valnos.push_back(VNI);
-    ++numvals;
   }
 
   // Okay, now insert the RHS live ranges into the LHS.
@@ -484,7 +482,6 @@
       VNInfo *VNI = valnos.back();
       valnos.pop_back();
       delete VNI;
-      --numvals;
     } while (valnos.back()->def == ~1U);
   } else {
     V1->def = ~1U;





More information about the llvm-commits mailing list