[llvm] 7d269a4 - [CodeGen] Use range-based for loops (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 3 21:43:15 PST 2024
Author: Kazu Hirata
Date: 2024-02-03T21:43:01-08:00
New Revision: 7d269a484142459a1154ba81c68bf0c31f291fc8
URL: https://github.com/llvm/llvm-project/commit/7d269a484142459a1154ba81c68bf0c31f291fc8
DIFF: https://github.com/llvm/llvm-project/commit/7d269a484142459a1154ba81c68bf0c31f291fc8.diff
LOG: [CodeGen] Use range-based for loops (NFC)
Added:
Modified:
llvm/lib/CodeGen/MachineBlockPlacement.cpp
llvm/lib/CodeGen/MachinePipeliner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index a7a839688ddfd..ef34e920aed50 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -2923,8 +2923,8 @@ void MachineBlockPlacement::alignBlocks() {
unsigned MDAlign = 1;
MDNode *LoopID = L->getLoopID();
if (LoopID) {
- for (unsigned I = 1, E = LoopID->getNumOperands(); I < E; ++I) {
- MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(I));
+ for (const MDOperand &MDO : llvm::drop_begin(LoopID->operands())) {
+ MDNode *MD = dyn_cast<MDNode>(MDO);
if (MD == nullptr)
continue;
MDString *S = dyn_cast<MDString>(MD->getOperand(0));
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 2d2d0bffe2169..697e0da094422 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -324,8 +324,8 @@ void MachinePipeliner::setPragmaPipelineOptions(MachineLoop &L) {
assert(LoopID->getNumOperands() > 0 && "requires atleast one operand");
assert(LoopID->getOperand(0) == LoopID && "invalid loop");
- for (unsigned i = 1, e = LoopID->getNumOperands(); i < e; ++i) {
- MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i));
+ for (const MDOperand &MDO : llvm::drop_begin(LoopID->operands())) {
+ MDNode *MD = dyn_cast<MDNode>(MDO);
if (MD == nullptr)
continue;
More information about the llvm-commits
mailing list