48 struct MakeGuardsExplicitLegacyPass :
public FunctionPass {
69 auto *WidenableCondition =
71 {}, {},
nullptr,
"widenable_cond");
74 B.CreateAnd(ExplicitGuard->
getCondition(), WidenableCondition);
75 NewCond->setName(
"exiplicit_guard_cond");
85 if (!GuardDecl || GuardDecl->use_empty())
93 if (GuardIntrinsics.
empty())
100 for (
auto *Guard : GuardIntrinsics)
112 "Lower the guard intrinsic to explicit control flow form",
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
void makeGuardControlFlowExplicit(Function *DeoptIntrinsic, CallInst *Guard)
Splits control flow at point of Guard, replacing it with explicit branch by the condition of guard's ...
void push_back(const T &Elt)
This class represents a function call, abstracting a target machine's calling convention.
Value * getCondition() const
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static bool runOnFunction(Function &F, bool PostInlining)
void setCallingConv(CallingConv::ID CC)
Type * getReturnType() const
Returns the type of the ret val.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
Conditional or Unconditional Branch instruction.
FunctionPass class - This class is used to implement most global optimizations.
void initializeMakeGuardsExplicitLegacyPassPass(PassRegistry &)
static bool explicifyGuards(Function &F)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isConditional() const
bool isGuard(const User *U)
Returns true iff U has semantics of a guard.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
LLVM_NODISCARD bool empty() const
CallingConv::ID getCallingConv() const
void setCondition(Value *V)
static void turnToExplicitForm(CallInst *Guard, Function *DeoptIntrinsic)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
INITIALIZE_PASS(MakeGuardsExplicitLegacyPass, "make-guards-explicit", "Lower the guard intrinsic to explicit control flow form", false, false) PreservedAnalyses MakeGuardsExplicitPass
Module * getParent()
Get the module that this global value is contained inside of...
inst_range instructions(Function *F)
A container for analyses that lazily runs them and caches their results.
const BasicBlock * getParent() const