BitcodeWriter: fix emission of invoke when calling a var-arg function with operand bundles

llvm-svn: 281940
This commit is contained in:
Mehdi Amini 2016-09-19 21:27:04 +00:00
parent c0e186029c
commit 04ba9d0985
2 changed files with 19 additions and 1 deletions

View File

@ -2500,7 +2500,7 @@ void ModuleBitcodeWriter::writeInstruction(const Instruction &I,
// Emit type/value pairs for varargs params.
if (FTy->isVarArg()) {
for (unsigned i = FTy->getNumParams(), e = I.getNumOperands()-3;
for (unsigned i = FTy->getNumParams(), e = II->getNumArgOperands();
i != e; ++i)
pushValueAndType(I.getOperand(i), InstID, Vals); // vararg
}

View File

@ -1590,6 +1590,24 @@ normal:
ret void
}
declare void @vaargs_func(...)
define void @invoke_with_operand_bundle_vaarg(i32* %ptr) personality i8 3 {
; CHECK-LABEL: @invoke_with_operand_bundle_vaarg(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
invoke void (...) @vaargs_func(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
to label %normal unwind label %exception
; CHECK: invoke void (...) @vaargs_func(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
exception:
%cleanup = landingpad i8 cleanup
br label %normal
normal:
ret void
}
declare void @f.writeonly() writeonly
; CHECK: declare void @f.writeonly() #39