diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-19 21:27:04 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-19 21:27:04 +0000 |
commit | a2d3e0354cab12e48c410ba163dd340ceb5131d7 (patch) | |
tree | 0a8d530be6d86d9414f9b5fc29e8b3f0f0d0fb63 | |
parent | 050e90399c531b247ad16cdf1c6078a4a654b351 (diff) |
BitcodeWriter: fix emission of invoke when calling a var-arg function with operand bundles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281940 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 2 | ||||
-rw-r--r-- | test/Bitcode/compatibility.ll | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 0fd239f71cc..df700a8aba1 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -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 } diff --git a/test/Bitcode/compatibility.ll b/test/Bitcode/compatibility.ll index 18270607c3c..7edaa16c748 100644 --- a/test/Bitcode/compatibility.ll +++ b/test/Bitcode/compatibility.ll @@ -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 |