aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-08-15 17:58:31 -0700
committerGitHub <noreply@github.com>2024-08-15 17:58:31 -0700
commitdfa13c010ff10b7bbbbf71c648de1b06ce58e34e (patch)
tree33dec354b55b3a34c9345b9cd3e11ef4613c3859 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent224b2800439ec0813a3fa861e98404624f18a6d7 (diff)
downloadllvm-dfa13c010ff10b7bbbbf71c648de1b06ce58e34e.zip
llvm-dfa13c010ff10b7bbbbf71c648de1b06ce58e34e.tar.gz
llvm-dfa13c010ff10b7bbbbf71c648de1b06ce58e34e.tar.bz2
[CodeGen] Use a range-based for loop (NFC) (#104408)
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 1fb37fb..ec5b757 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -7382,12 +7382,9 @@ bool CodeGenPrepare::tryToSinkFreeOperands(Instruction *I) {
if (IsHugeFunc) {
// Now we clone an instruction, its operands' defs may sink to this BB
// now. So we put the operands defs' BBs into FreshBBs to do optimization.
- for (unsigned I = 0; I < NI->getNumOperands(); ++I) {
- auto *OpDef = dyn_cast<Instruction>(NI->getOperand(I));
- if (!OpDef)
- continue;
- FreshBBs.insert(OpDef->getParent());
- }
+ for (Value *Op : NI->operands())
+ if (auto *OpDef = dyn_cast<Instruction>(Op))
+ FreshBBs.insert(OpDef->getParent());
}
NewInstructions[UI] = NI;