From 0eb3a3524e9d68642e574780d19c781386ed4469 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Mon, 11 Jun 2012 23:42:23 +0000 Subject: [PATCH] misched: When querying RegisterPressureTracker, always save current and max pressure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158340 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/RegisterPressure.h | 13 ++++++++----- lib/CodeGen/RegisterPressure.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/llvm/CodeGen/RegisterPressure.h b/include/llvm/CodeGen/RegisterPressure.h index e810f8c64bb..2043155bc53 100644 --- a/include/llvm/CodeGen/RegisterPressure.h +++ b/include/llvm/CodeGen/RegisterPressure.h @@ -249,19 +249,22 @@ public: /// Get the pressure of each PSet after traversing this instruction bottom-up. void getUpwardPressure(const MachineInstr *MI, - std::vector &PressureResult); + std::vector &PressureResult, + std::vector &MaxPressureResult); /// Get the pressure of each PSet after traversing this instruction top-down. void getDownwardPressure(const MachineInstr *MI, - std::vector &PressureResult); + std::vector &PressureResult, + std::vector &MaxPressureResult); void getPressureAfterInst(const MachineInstr *MI, - std::vector &PressureResult) { + std::vector &PressureResult, + std::vector &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: diff --git a/lib/CodeGen/RegisterPressure.cpp b/lib/CodeGen/RegisterPressure.cpp index 52174d8f37e..43448c850a0 100644 --- a/lib/CodeGen/RegisterPressure.cpp +++ b/lib/CodeGen/RegisterPressure.cpp @@ -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 &PressureResult) { + std::vector &PressureResult, + std::vector &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 &PressureResult) { + std::vector &PressureResult, + std::vector &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); }