Skip to content

Commit ed6292b

Browse files
authored
Merge pull request rust-lang#128 from vext01/varargs
Fix varargs
2 parents ef74f10 + 615359a commit ed6292b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,15 @@ class YkIRWriter {
418418
// opcode:
419419
serialiseOpcode(OpCode::Call);
420420
// num_operands:
421-
unsigned NumOpers = I->getNumOperands();
422-
OutStreamer.emitInt32(NumOpers);
421+
OutStreamer.emitInt32(I->arg_size() + 1); // +1 for callee operand.
423422

424423
// OPERAND 0: What to call.
425424
//
426425
// In LLVM IR this is the final operand, which is a cause of confusion.
427-
serialiseOperand(I, VLMap, I->getOperand(NumOpers - 1));
426+
serialiseOperand(I, VLMap, I->getCalledOperand());
428427

429428
// Now the rest of the operands.
430-
for (unsigned OI = 0; OI < NumOpers - 1; OI++) {
429+
for (unsigned OI = 0; OI < I->arg_size(); OI++) {
431430
serialiseOperand(I, VLMap, I->getOperand(OI));
432431
}
433432

0 commit comments

Comments
 (0)