diff options
| author | Matthias Braun <matze@braunis.de> | 2015-10-16 23:25:09 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2015-10-16 23:25:09 +0000 |
| commit | fdee8ec2bd037550ca648c1891a8b385109b0188 (patch) | |
| tree | 9d110bd24b761a3b56414a676e2336dc23df9d08 | |
| parent | 80c94a7856bf3cc8297c39c95bc12bd831656f5b (diff) | |
| download | bcm5719-llvm-fdee8ec2bd037550ca648c1891a8b385109b0188.tar.gz bcm5719-llvm-fdee8ec2bd037550ca648c1891a8b385109b0188.zip | |
RegisterPressure: Use range based for, cleanup
llvm-svn: 250579
| -rw-r--r-- | llvm/lib/CodeGen/RegisterPressure.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/RegisterPressure.cpp b/llvm/lib/CodeGen/RegisterPressure.cpp index 5da683eb999..87c3d46866e 100644 --- a/llvm/lib/CodeGen/RegisterPressure.cpp +++ b/llvm/lib/CodeGen/RegisterPressure.cpp @@ -882,19 +882,13 @@ getUpwardPressureDelta(const MachineInstr *MI, /*const*/ PressureDiff &PDiff, } /// Helper to find a vreg use between two indices [PriorUseIdx, NextUseIdx). -static bool findUseBetween(unsigned Reg, - SlotIndex PriorUseIdx, SlotIndex NextUseIdx, - const MachineRegisterInfo *MRI, +static bool findUseBetween(unsigned Reg, SlotIndex PriorUseIdx, + SlotIndex NextUseIdx, const MachineRegisterInfo &MRI, const LiveIntervals *LIS) { - for (MachineRegisterInfo::use_instr_nodbg_iterator - UI = MRI->use_instr_nodbg_begin(Reg), - UE = MRI->use_instr_nodbg_end(); UI != UE; ++UI) { - const MachineInstr* MI = &*UI; - if (MI->isDebugValue()) - continue; - SlotIndex InstSlot = LIS->getInstructionIndex(MI).getRegSlot(); - if (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx) - return true; + for (const MachineInstr &MI : MRI.use_nodbg_instructions(Reg)) { + SlotIndex InstSlot = LIS->getInstructionIndex(&MI).getRegSlot(); + if (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx) + return true; } return false; } @@ -927,9 +921,8 @@ void RegPressureTracker::bumpDownwardPressure(const MachineInstr *MI) { const LiveRange *LR = getLiveRange(Reg); if (LR) { LiveQueryResult LRQ = LR->Query(SlotIdx); - if (LRQ.isKill() && !findUseBetween(Reg, CurrIdx, SlotIdx, MRI, LIS)) { + if (LRQ.isKill() && !findUseBetween(Reg, CurrIdx, SlotIdx, *MRI, LIS)) decreaseRegPressure(Reg); - } } } else if (!TargetRegisterInfo::isVirtualRegister(Reg)) { |

