aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2021-03-03 12:07:00 -0800
committerPhilip Reames <listmail@philipreames.com>2021-03-03 12:07:55 -0800
commit99f541734695307f67cada305856cfece4ada88e (patch)
tree85aa77429d147ab44e6af65f81094cc1fa11910a /llvm/lib/IR/Instructions.cpp
parent805115655ee4886d212ef5aebca852cb5ebedc72 (diff)
downloadllvm-99f541734695307f67cada305856cfece4ada88e.zip
llvm-99f541734695307f67cada305856cfece4ada88e.tar.gz
llvm-99f541734695307f67cada305856cfece4ada88e.tar.bz2
Sink routine for replacing a operand bundle to CallBase [NFC]
We had equivalent code for both CallInst and InvokeInst, but never cared about the result type.
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r--llvm/lib/IR/Instructions.cpp38
1 files changed, 13 insertions, 25 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 2680972..6b33c03 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -262,6 +262,19 @@ CallBase *CallBase::Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
}
}
+CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
+ Instruction *InsertPt) {
+ SmallVector<OperandBundleDef, 2> OpDefs;
+ for (unsigned i = 0, e = CI->getNumOperandBundles(); i < e; ++i) {
+ auto ChildOB = CI->getOperandBundleAt(i);
+ if (ChildOB.getTagName() != OpB.getTag())
+ OpDefs.emplace_back(ChildOB);
+ }
+ OpDefs.emplace_back(OpB);
+ return CallBase::Create(CI, OpDefs, InsertPt);
+}
+
+
Function *CallBase::getCaller() { return getParent()->getParent(); }
unsigned CallBase::getNumSubclassExtraOperandsDynamic() const {
@@ -506,18 +519,6 @@ CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
return NewCI;
}
-CallInst *CallInst::CreateWithReplacedBundle(CallInst *CI, OperandBundleDef OpB,
- Instruction *InsertPt) {
- SmallVector<OperandBundleDef, 2> OpDefs;
- for (unsigned i = 0, e = CI->getNumOperandBundles(); i < e; ++i) {
- auto ChildOB = CI->getOperandBundleAt(i);
- if (ChildOB.getTagName() != OpB.getTag())
- OpDefs.emplace_back(ChildOB);
- }
- OpDefs.emplace_back(OpB);
- return CallInst::Create(CI, OpDefs, InsertPt);
-}
-
// Update profile weight for call instruction by scaling it using the ratio
// of S/T. The meaning of "branch_weights" meta data for call instruction is
// transfered to represent call count.
@@ -830,19 +831,6 @@ InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB,
return NewII;
}
-InvokeInst *InvokeInst::CreateWithReplacedBundle(InvokeInst *II,
- OperandBundleDef OpB,
- Instruction *InsertPt) {
- SmallVector<OperandBundleDef, 2> OpDefs;
- for (unsigned i = 0, e = II->getNumOperandBundles(); i < e; ++i) {
- auto ChildOB = II->getOperandBundleAt(i);
- if (ChildOB.getTagName() != OpB.getTag())
- OpDefs.emplace_back(ChildOB);
- }
- OpDefs.emplace_back(OpB);
- return InvokeInst::Create(II, OpDefs, InsertPt);
-}
-
LandingPadInst *InvokeInst::getLandingPadInst() const {
return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI());
}