From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- llvm/lib/Transforms/CFGuard/CFGuard.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Transforms/CFGuard') 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(CB)) { - NewCB = CallInst::Create(CI, Bundles, CB); - } else { - assert(isa(CB) && "Unknown indirect call type"); - InvokeInst *II = cast(CB); - NewCB = llvm::InvokeInst::Create(II, Bundles, CB); - } + assert((isa(CB) || isa(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 +} -- cgit v1.2.3