[llvm] 66878ff - [Hexagon] Use range-based for loops (NFC) (#104538)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 08:36:04 PDT 2024
Author: Kazu Hirata
Date: 2024-08-16T08:35:59-07:00
New Revision: 66878ff69293c4008707261592d448d5896239e7
URL: https://github.com/llvm/llvm-project/commit/66878ff69293c4008707261592d448d5896239e7
DIFF: https://github.com/llvm/llvm-project/commit/66878ff69293c4008707261592d448d5896239e7.diff
LOG: [Hexagon] Use range-based for loops (NFC) (#104538)
Added:
Modified:
llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
index a2230289ae69c7..59c882bf37afaa 100644
--- a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
@@ -249,9 +249,7 @@ void HexagonCopyHoisting::moveCopyInstr(MachineBasicBlock *DestBB,
DestBB->splice(FirstTI, MI->getParent(), MI);
addMItoCopyList(MI);
- for (auto I = std::next(DestBB->succ_begin()), E = DestBB->succ_end(); I != E;
- ++I) {
- MachineBasicBlock *SuccBB = *I;
+ for (MachineBasicBlock *SuccBB : drop_begin(DestBB->successors())) {
auto &BBCopyInst = CopyMIList[SuccBB->getNumber()];
MachineInstr *SuccMI = BBCopyInst[Key];
SuccMI->eraseFromParent();
diff --git a/llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp b/llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp
index 651ccc2db9ba24..92574a16c4f931 100644
--- a/llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp
@@ -86,11 +86,9 @@ bool HexagonGenMemAbsolute::runOnMachineFunction(MachineFunction &Fn) {
getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
// Loop over all of the basic blocks
- for (MachineFunction::iterator MBBb = Fn.begin(), MBBe = Fn.end();
- MBBb != MBBe; ++MBBb) {
- MachineBasicBlock *MBB = &*MBBb;
+ for (MachineBasicBlock &MBB : Fn) {
// Traverse the basic block
- for (MachineBasicBlock::iterator MII = MBB->begin(); MII != MBB->end();
+ for (MachineBasicBlock::iterator MII = MBB.begin(); MII != MBB.end();
++MII) {
MachineInstr *MI = &*MII;
int Opc = MI->getOpcode();
@@ -205,7 +203,7 @@ bool HexagonGenMemAbsolute::runOnMachineFunction(MachineFunction &Fn) {
LLVM_DEBUG(dbgs() << "Replaced with " << *MIB << "\n");
// Erase the instructions that got replaced.
- MII = MBB->erase(MI);
+ MII = MBB.erase(MI);
--MII;
NextMI->getParent()->erase(NextMI);
}
More information about the llvm-commits
mailing list