misched: When querying RegisterPressureTracker, always save current and max pressure.
authorAndrew Trick <atrick@apple.com>
Mon, 11 Jun 2012 23:42:23 +0000 (23:42 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 11 Jun 2012 23:42:23 +0000 (23:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158340 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/RegisterPressure.h
lib/CodeGen/RegisterPressure.cpp

index e810f8c64bb5edd264d2b417e49cbb405f196dbe..2043155bc53f51c9cca473b506c2a3e26b0e85a9 100644 (file)
@@ -249,19 +249,22 @@ public:
 
   /// Get the pressure of each PSet after traversing this instruction bottom-up.
   void getUpwardPressure(const MachineInstr *MI,
-                         std::vector<unsigned> &PressureResult);
+                         std::vector<unsigned> &PressureResult,
+                         std::vector<unsigned> &MaxPressureResult);
 
   /// Get the pressure of each PSet after traversing this instruction top-down.
   void getDownwardPressure(const MachineInstr *MI,
-                           std::vector<unsigned> &PressureResult);
+                           std::vector<unsigned> &PressureResult,
+                           std::vector<unsigned> &MaxPressureResult);
 
   void getPressureAfterInst(const MachineInstr *MI,
-                            std::vector<unsigned> &PressureResult) {
+                            std::vector<unsigned> &PressureResult,
+                            std::vector<unsigned> &MaxPressureResult) {
     if (isTopClosed())
-      return getUpwardPressure(MI, PressureResult);
+      return getUpwardPressure(MI, PressureResult, MaxPressureResult);
 
     assert(isBottomClosed() && "Uninitialized pressure tracker");
-    return getDownwardPressure(MI, PressureResult);
+    return getDownwardPressure(MI, PressureResult, MaxPressureResult);
   }
 
 protected:
index 52174d8f37efdc3b679fb702653f88a373ca440e..43448c850a0b136a987972af490ce2e11feec602 100644 (file)
@@ -811,25 +811,31 @@ getMaxDownwardPressureDelta(const MachineInstr *MI, RegPressureDelta &Delta,
 /// Get the pressure of each PSet after traversing this instruction bottom-up.
 void RegPressureTracker::
 getUpwardPressure(const MachineInstr *MI,
-                  std::vector<unsigned> &PressureResult) {
+                  std::vector<unsigned> &PressureResult,
+                  std::vector<unsigned> &MaxPressureResult) {
   // Snapshot pressure.
   PressureResult = CurrSetPressure;
+  MaxPressureResult = P.MaxSetPressure;
 
   bumpUpwardPressure(MI);
 
   // Current pressure becomes the result. Restore current pressure.
+  P.MaxSetPressure.swap(MaxPressureResult);
   CurrSetPressure.swap(PressureResult);
 }
 
 /// Get the pressure of each PSet after traversing this instruction top-down.
 void RegPressureTracker::
 getDownwardPressure(const MachineInstr *MI,
-                    std::vector<unsigned> &PressureResult) {
+                    std::vector<unsigned> &PressureResult,
+                    std::vector<unsigned> &MaxPressureResult) {
   // Snapshot pressure.
   PressureResult = CurrSetPressure;
+  MaxPressureResult = P.MaxSetPressure;
 
   bumpDownwardPressure(MI);
 
   // Current pressure becomes the result. Restore current pressure.
+  P.MaxSetPressure.swap(MaxPressureResult);
   CurrSetPressure.swap(PressureResult);
 }