From 74c5fa12a8417d12d9c811255ab2b81f98f87e39 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 13 Aug 2024 23:31:40 -0700 Subject: [Bitcode] Use range-based for loops (NFC) (#103628) --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 33ec14b60dd2..460db6fc01de 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(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: { -- cgit v1.2.3