summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-07-21 13:11:25 -0700
committerGitHub <noreply@github.com>2024-07-21 13:11:25 -0700
commit5c83498984dd5d278c40d6650d3f9205b5131550 (patch)
tree42ce39325e42b4143045e5f7d6c2f78b944338ce /llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
parent09a399a1ddbef1e5e51b77fd6bd1792d34697187 (diff)
[Transforms] Use range-based for loops (NFC) (#99607)
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index f54eebb2874a..cafec165f6d6 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -261,20 +261,20 @@ void LoopVectorizeHints::getHintsFromMetadata() {
assert(LoopID->getNumOperands() > 0 && "requires at least one operand");
assert(LoopID->getOperand(0) == LoopID && "invalid loop id");
- for (unsigned i = 1, ie = LoopID->getNumOperands(); i < ie; ++i) {
+ for (const MDOperand &MDO : llvm::drop_begin(LoopID->operands())) {
const MDString *S = nullptr;
SmallVector<Metadata *, 4> Args;
// The expected hint is either a MDString or a MDNode with the first
// operand a MDString.
- if (const MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i))) {
+ if (const MDNode *MD = dyn_cast<MDNode>(MDO)) {
if (!MD || MD->getNumOperands() == 0)
continue;
S = dyn_cast<MDString>(MD->getOperand(0));
for (unsigned i = 1, ie = MD->getNumOperands(); i < ie; ++i)
Args.push_back(MD->getOperand(i));
} else {
- S = dyn_cast<MDString>(LoopID->getOperand(i));
+ S = dyn_cast<MDString>(MDO);
assert(Args.size() == 0 && "too many arguments for MDString");
}