Skip to content

Commit 6336892

Browse files
committed
Fix serialisation of vararg calls.
Non-static arguments were being missed. Fix by using I->arg_size() instead of I->getNumOperands().
1 parent ef74f10 commit 6336892

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 2 additions & 3 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.
427426
serialiseOperand(I, VLMap, I->getOperand(NumOpers - 1));
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)