diff --git a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp --- a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp +++ b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp @@ -109,6 +109,8 @@ SmallVector Args(CI->args()); CallInst *NewCI = Builder.CreateCall(FCache, Args); NewCI->setName(CI->getName()); + if (CI->hasFnAttr(Attribute::NoUnwind)) + NewCI->addFnAttr(Attribute::NoUnwind); // Try to set the most appropriate TailCallKind based on both the current // attributes and the ones that we could get from ObjCARC's special diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -966,12 +966,10 @@ if (FuncletBundleOperand == FuncletPad) continue; - // Skip call sites which are nounwind intrinsics or inline asm. - auto *CalledFn = - dyn_cast(CB->getCalledOperand()->stripPointerCasts()); - if (CalledFn && ((CalledFn->isIntrinsic() && CB->doesNotThrow()) || - CB->isInlineAsm())) - continue; + // Skip call sites which are nounwind or inline asm. + if (isa(CB->getCalledOperand()->stripPointerCasts())) + if (CB->doesNotThrow() || CB->isInlineAsm()) + continue; // This call site was not part of this funclet, remove it. if (isa(CB)) {