30 auto *GuardDecl =
F.getParent()->getFunction(
32 if (!GuardDecl || GuardDecl->use_empty())
39 for (
auto *U : GuardDecl->users())
40 if (
auto *CI = dyn_cast<CallInst>(U))
41 if (CI->getFunction() == &
F)
48 F.getParent(), Intrinsic::experimental_deoptimize, {F.getReturnType()});
49 DeoptIntrinsic->setCallingConv(GuardDecl->getCallingConv());
51 for (
auto *CI : ToLower) {
53 CI->eraseFromParent();
static bool lowerGuardIntrinsic(Function &F)
Module.h This file contains the declarations for the Module class.
This file defines the SmallVector class.
A container for analyses that lazily runs them and caches their results.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
This is an optimization pass for GlobalISel generic memory operations.
void makeGuardControlFlowExplicit(Function *DeoptIntrinsic, CallInst *Guard, bool UseWC)
Splits control flow at point of Guard, replacing it with explicit branch by the condition of guard's ...
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)