[llvm] 74c5fa1 - [Bitcode] Use range-based for loops (NFC) (#103628)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 23:31:43 PDT 2024
Author: Kazu Hirata
Date: 2024-08-13T23:31:40-07:00
New Revision: 74c5fa12a8417d12d9c811255ab2b81f98f87e39
URL: https://github.com/llvm/llvm-project/commit/74c5fa12a8417d12d9c811255ab2b81f98f87e39
DIFF: https://github.com/llvm/llvm-project/commit/74c5fa12a8417d12d9c811255ab2b81f98f87e39.diff
LOG: [Bitcode] Use range-based for loops (NFC) (#103628)
Added:
Modified:
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 33ec14b60dd288..460db6fc01de4a 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -3008,8 +3008,8 @@ void ModuleBitcodeWriter::writeInstruction(const Instruction &I,
auto &GEPInst = cast<GetElementPtrInst>(I);
Vals.push_back(getOptimizationFlags(&I));
Vals.push_back(VE.getTypeID(GEPInst.getSourceElementType()));
- for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
- pushValueAndType(I.getOperand(i), InstID, Vals);
+ for (const Value *Op : I.operands())
+ pushValueAndType(Op, InstID, Vals);
break;
}
case Instruction::ExtractValue: {
@@ -3112,8 +3112,8 @@ void ModuleBitcodeWriter::writeInstruction(const Instruction &I,
Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
// Encode the address operand as relative, but not the basic blocks.
pushValue(I.getOperand(0), InstID, Vals);
- for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i)
- Vals.push_back(VE.getValueID(I.getOperand(i)));
+ for (const Value *Op : drop_begin(I.operands()))
+ Vals.push_back(VE.getValueID(Op));
break;
case Instruction::Invoke: {
More information about the llvm-commits
mailing list