Go to the documentation of this file.
27 cl::desc(
"The probability of a guard failing is assumed to be the "
28 "reciprocal of this value (default = 1 << 20)"));
36 auto *DeoptBlockTerm =
39 auto *CheckBI = cast<BranchInst>(CheckBB->getTerminator());
43 CheckBI->swapSuccessors();
45 CheckBI->getSuccessor(0)->setName(
"guarded");
46 CheckBI->getSuccessor(1)->setName(
"deopt");
48 if (
auto *MD = Guard->
getMetadata(LLVMContext::MD_make_implicit))
49 CheckBI->setMetadata(LLVMContext::MD_make_implicit, MD);
52 CheckBI->setMetadata(LLVMContext::MD_prof,
56 auto *DeoptCall =
B.CreateCall(DeoptIntrinsic,
Args, {DeoptOB},
"");
61 DeoptCall->setName(
"deoptcall");
62 B.CreateRet(DeoptCall);
66 DeoptBlockTerm->eraseFromParent();
73 auto *WC =
B.CreateIntrinsic(Intrinsic::experimental_widenable_condition,
74 {}, {},
nullptr,
"widenable_cond");
75 CheckBI->setCondition(
B.CreateAnd(CheckBI->getCondition(), WC,
76 "exiplicit_guard_cond"));
100 C->set(
B.CreateAnd(NewCond,
C->get()));
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 ...
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A container for an operand bundle being viewed as a set of values rather than a set of uses.
LLVM Basic Block Representation.
void setWidenableBranchCond(BranchInst *WidenableBR, Value *Cond)
Given a branch we know is widenable (defined per Analysis/GuardUtils.h), set it's condition such that...
(vector float) vec_cmpeq(*A, *B) C
MDNode * createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight)
Return metadata containing two branch weights.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void setCondition(Value *V)
CallingConv::ID getCallingConv() const
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Value * getCondition() const
Type * getReturnType() const
Returns the type of the ret val.
initializer< Ty > init(const Ty &Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void widenWidenableBranch(BranchInst *WidenableBR, Value *NewCond)
Given a branch we know is widenable (defined per Analysis/GuardUtils.h), widen it such that condition...
bool isVoidTy() const
Return true if this is 'void'.
bool parseWidenableBranch(const User *U, Value *&Condition, Value *&WidenableCondition, BasicBlock *&IfTrueBB, BasicBlock *&IfFalseBB)
If U is widenable branch looking like: cond = ...
bool isWidenableBranch(const User *U)
Returns true iff U is a widenable branch (that is, parseWidenableBranch returns true).
LLVMContext & getContext() const
All values hold a context through their type.
Value * getArgOperand(unsigned i) const
const BasicBlock * getParent() const
This class represents a function call, abstracting a target machine's calling convention.
Instruction * SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore, bool Unreachable, MDNode *BranchWeights, DominatorTree *DT, LoopInfo *LI=nullptr, BasicBlock *ThenBlock=nullptr)
Split the containing block at the specified instruction - everything before SplitBefore stays in the ...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Conditional or Unconditional Branch instruction.
LLVM Value Representation.
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
void moveBefore(Instruction *MovePos)
Unlink this instruction from its current basic block and insert it into the basic block that MovePos ...
A Use represents the edge between a Value definition and its users.