[llvm] r250579 - RegisterPressure: Use range based for, cleanup
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 16:25:09 PDT 2015
Author: matze
Date: Fri Oct 16 18:25:09 2015
New Revision: 250579
URL: http://llvm.org/viewvc/llvm-project?rev=250579&view=rev
Log:
RegisterPressure: Use range based for, cleanup
Modified:
llvm/trunk/lib/CodeGen/RegisterPressure.cpp
Modified: llvm/trunk/lib/CodeGen/RegisterPressure.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterPressure.cpp?rev=250579&r1=250578&r2=250579&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterPressure.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterPressure.cpp Fri Oct 16 18:25:09 2015
@@ -882,19 +882,13 @@ getUpwardPressureDelta(const MachineInst
}
/// 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::bumpDownwardPre
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)) {
More information about the llvm-commits
mailing list