diff options
author | Heejin Ahn <aheejin@gmail.com> | 2018-05-09 00:53:50 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2018-05-09 00:53:50 +0000 |
commit | bf7716952a3aee11be187e57887c32e1399d9f17 (patch) | |
tree | 96084a3d1b313b276a8b6dac6122a7c34850f145 /llvm/lib/Transforms/Utils | |
parent | fb663789d3c862353d6077e71df4efd1bcb9477b (diff) | |
download | bcm5719-llvm-bf7716952a3aee11be187e57887c32e1399d9f17.tar.gz bcm5719-llvm-bf7716952a3aee11be187e57887c32e1399d9f17.zip |
Support a funclet operand bundle in LowerInvoke
Summary:
The current LowerInvoke pass cannot handle invoke instructions with a
funclet bundle operand. The order of operands for an invoke instruction
is {call arguments, callee, funclet operand (if any), normal dest,
unwind dest}. The current code assumes there is no funclet operand and
incorrectly includes a funclet operand into call arguments.
Reviewers: rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46242
llvm-svn: 331832
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/LowerInvoke.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LowerInvoke.cpp b/llvm/lib/Transforms/Utils/LowerInvoke.cpp index 383b43ee817..c852d538b0d 100644 --- a/llvm/lib/Transforms/Utils/LowerInvoke.cpp +++ b/llvm/lib/Transforms/Utils/LowerInvoke.cpp @@ -48,10 +48,12 @@ static bool runImpl(Function &F) { bool Changed = false; for (BasicBlock &BB : F) if (InvokeInst *II = dyn_cast<InvokeInst>(BB.getTerminator())) { - SmallVector<Value *, 16> CallArgs(II->op_begin(), II->op_end() - 3); + SmallVector<Value *, 16> CallArgs(II->arg_begin(), II->arg_end()); + SmallVector<OperandBundleDef, 1> OpBundles; + II->getOperandBundlesAsDefs(OpBundles); // Insert a normal call instruction... CallInst *NewCall = - CallInst::Create(II->getCalledValue(), CallArgs, "", II); + CallInst::Create(II->getCalledValue(), CallArgs, OpBundles, "", II); NewCall->takeName(II); NewCall->setCallingConv(II->getCallingConv()); NewCall->setAttributes(II->getAttributes()); |