Go to the documentation of this file.
31 struct LowerGuardIntrinsicLegacyPass :
public FunctionPass {
45 auto *GuardDecl =
F.getParent()->getFunction(
47 if (!GuardDecl || GuardDecl->use_empty())
54 for (
auto *U : GuardDecl->users())
55 if (
auto *CI = dyn_cast<CallInst>(U))
56 if (CI->getFunction() == &
F)
57 ToLower.push_back(CI);
63 F.getParent(), Intrinsic::experimental_deoptimize, {F.getReturnType()});
64 DeoptIntrinsic->setCallingConv(GuardDecl->getCallingConv());
66 for (
auto *CI : ToLower) {
68 CI->eraseFromParent();
80 "Lower the guard intrinsic to normal control flow",
false,
84 return new LowerGuardIntrinsicLegacyPass();
A set of analyses that are preserved following a run of a transformation pass.
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 ...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
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".
static bool lowerGuardIntrinsic(Function &F)
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void initializeLowerGuardIntrinsicLegacyPassPass(PassRegistry &)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
INITIALIZE_PASS(LowerGuardIntrinsicLegacyPass, "lower-guard-intrinsic", "Lower the guard intrinsic to normal control flow", false, false) Pass *llvm
Pass * createLowerGuardIntrinsicPass()
static bool runOnFunction(Function &F, bool PostInlining)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Pass interface - Implemented by all 'passes'.
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.