diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-18 06:23:38 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-18 06:23:38 +0000 |
commit | 2d16145acfb67c7498cf43a7a3fd04b543a2a767 (patch) | |
tree | 74b80d99ba3f29404784d23a813a537859a88549 /llvm/lib/IR/Instructions.cpp | |
parent | 9c8904fb3819ecb3cde7882e8b66ad03db4bab1d (diff) | |
download | llvm-2d16145acfb67c7498cf43a7a3fd04b543a2a767.zip llvm-2d16145acfb67c7498cf43a7a3fd04b543a2a767.tar.gz llvm-2d16145acfb67c7498cf43a7a3fd04b543a2a767.tar.bz2 |
Teach the inliner to track deoptimization state
Summary:
This change teaches LLVM's inliner to track and suitably adjust
deoptimization state (tracked via deoptimization operand bundles) as it
inlines through call sites. The operation is described in more detail
in the LangRef changes.
Reviewers: reames, majnemer, chandlerc, dexonsmith
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14552
llvm-svn: 253438
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 9b6dfc2..b8c72dd 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -297,6 +297,19 @@ CallInst::CallInst(const CallInst &CI) SubclassOptionalData = CI.SubclassOptionalData; } +CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB, + Instruction *InsertPt) { + CallSite CS(CI); + std::vector<Value *> Args(CS.arg_begin(), CS.arg_end()); + + auto *NewCI = CallInst::Create(CI->getCalledValue(), Args, OpB, CI->getName(), + InsertPt); + NewCI->setTailCallKind(CI->getTailCallKind()); + NewCI->setCallingConv(CI->getCallingConv()); + NewCI->SubclassOptionalData = CI->SubclassOptionalData; + return NewCI; +} + void CallInst::addAttribute(unsigned i, Attribute::AttrKind attr) { AttributeSet PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, attr); @@ -571,6 +584,19 @@ InvokeInst::InvokeInst(const InvokeInst &II) SubclassOptionalData = II.SubclassOptionalData; } +InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB, + Instruction *InsertPt) { + CallSite CS(II); + std::vector<Value *> Args(CS.arg_begin(), CS.arg_end()); + + auto *NewII = InvokeInst::Create(II->getCalledValue(), II->getNormalDest(), + II->getUnwindDest(), Args, OpB, + II->getName(), InsertPt); + NewII->setCallingConv(II->getCallingConv()); + NewII->SubclassOptionalData = II->SubclassOptionalData; + return NewII; +} + BasicBlock *InvokeInst::getSuccessorV(unsigned idx) const { return getSuccessor(idx); } |