aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RegAllocBasic.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2021-02-17 23:58:46 -0800
committerKazu Hirata <kazu@google.com>2021-02-17 23:58:46 -0800
commit61efa3d93f733c6310abf079cd27f99868c38461 (patch)
tree7ee890edd7c783f4d1be4bb8c0cd6eee8efd7893 /llvm/lib/CodeGen/RegAllocBasic.cpp
parente54579307b15ac0adfe96c5422e9cdd228ed1a76 (diff)
downloadllvm-61efa3d93f733c6310abf079cd27f99868c38461.zip
llvm-61efa3d93f733c6310abf079cd27f99868c38461.tar.gz
llvm-61efa3d93f733c6310abf079cd27f99868c38461.tar.bz2
[CodeGen] Use range-based for loops (NFC)
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocBasic.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocBasic.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp
index 8f2cb48..ae10b8e 100644
--- a/llvm/lib/CodeGen/RegAllocBasic.cpp
+++ b/llvm/lib/CodeGen/RegAllocBasic.cpp
@@ -286,16 +286,14 @@ MCRegister RABasic::selectOrSplit(LiveInterval &VirtReg,
}
// Try to spill another interfering reg with less spill weight.
- for (auto PhysRegI = PhysRegSpillCands.begin(),
- PhysRegE = PhysRegSpillCands.end();
- PhysRegI != PhysRegE; ++PhysRegI) {
- if (!spillInterferences(VirtReg, *PhysRegI, SplitVRegs))
+ for (MCRegister &PhysReg : PhysRegSpillCands) {
+ if (!spillInterferences(VirtReg, PhysReg, SplitVRegs))
continue;
- assert(!Matrix->checkInterference(VirtReg, *PhysRegI) &&
+ assert(!Matrix->checkInterference(VirtReg, PhysReg) &&
"Interference after spill.");
// Tell the caller to allocate to this newly freed physical register.
- return *PhysRegI;
+ return PhysReg;
}
// No other spill candidates were found, so spill the current VirtReg.