diff options
Diffstat (limited to 'llvm/lib/Transforms/CFGuard/CFGuard.cpp')
-rw-r--r-- | llvm/lib/Transforms/CFGuard/CFGuard.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/CFGuard/CFGuard.cpp b/llvm/lib/Transforms/CFGuard/CFGuard.cpp index 7c5e90cb53cd..96c083a144b2 100644 --- a/llvm/lib/Transforms/CFGuard/CFGuard.cpp +++ b/llvm/lib/Transforms/CFGuard/CFGuard.cpp @@ -204,14 +204,9 @@ void CFGuard::insertCFGuardDispatch(CallBase *CB) { Bundles.emplace_back("cfguardtarget", CalledOperand); // Create a copy of the call/invoke instruction and add the new bundle. - CallBase *NewCB; - if (CallInst *CI = dyn_cast<CallInst>(CB)) { - NewCB = CallInst::Create(CI, Bundles, CB); - } else { - assert(isa<InvokeInst>(CB) && "Unknown indirect call type"); - InvokeInst *II = cast<InvokeInst>(CB); - NewCB = llvm::InvokeInst::Create(II, Bundles, CB); - } + assert((isa<CallInst>(CB) || isa<InvokeInst>(CB)) && + "Unknown indirect call type"); + CallBase *NewCB = CallBase::Create(CB, Bundles, CB); // Change the target of the call to be the guard dispatch function. NewCB->setCalledOperand(GuardDispatchLoad); @@ -302,4 +297,4 @@ FunctionPass *llvm::createCFGuardCheckPass() { FunctionPass *llvm::createCFGuardDispatchPass() { return new CFGuard(CFGuard::CF_Dispatch); -}
\ No newline at end of file +} |