[IR] Make {Call,Invoke}::cloneImpl aware of operand bundles
authorSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 10 Nov 2015 20:13:21 +0000 (20:13 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 10 Nov 2015 20:13:21 +0000 (20:13 +0000)
This was an omission in the patch that landed initial support for
operand bundles.  So far we haven't hit this, but we will once the
inliner is able to inline calls to functions that contain calls with
operand bundles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252645 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Instructions.cpp

index dfd711f5c23aa42d4c90443b6de64d64e900df5b..9b6dfc2bf6aeac5e849219f38f661817bd57fc0f 100644 (file)
@@ -3989,6 +3989,10 @@ AddrSpaceCastInst *AddrSpaceCastInst::cloneImpl() const {
 }
 
 CallInst *CallInst::cloneImpl() const {
 }
 
 CallInst *CallInst::cloneImpl() const {
+  if (hasOperandBundles()) {
+    unsigned DescriptorBytes = getNumOperandBundles() * sizeof(BundleOpInfo);
+    return new(getNumOperands(), DescriptorBytes) CallInst(*this);
+  }
   return  new(getNumOperands()) CallInst(*this);
 }
 
   return  new(getNumOperands()) CallInst(*this);
 }
 
@@ -4033,6 +4037,10 @@ IndirectBrInst *IndirectBrInst::cloneImpl() const {
 }
 
 InvokeInst *InvokeInst::cloneImpl() const {
 }
 
 InvokeInst *InvokeInst::cloneImpl() const {
+  if (hasOperandBundles()) {
+    unsigned DescriptorBytes = getNumOperandBundles() * sizeof(BundleOpInfo);
+    return new(getNumOperands(), DescriptorBytes) InvokeInst(*this);
+  }
   return new(getNumOperands()) InvokeInst(*this);
 }
 
   return new(getNumOperands()) InvokeInst(*this);
 }