LLVM  7.0.0
SIAnnotateControlFlow.cpp
Go to the documentation of this file.
1 //===- SIAnnotateControlFlow.cpp ------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file
11 /// Annotates the control flow with hardware specific intrinsics.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "AMDGPU.h"
17 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/Analysis/LoopInfo.h"
22 #include "llvm/IR/BasicBlock.h"
23 #include "llvm/IR/CFG.h"
24 #include "llvm/IR/Constant.h"
25 #include "llvm/IR/Constants.h"
26 #include "llvm/IR/DerivedTypes.h"
27 #include "llvm/IR/Dominators.h"
28 #include "llvm/IR/Function.h"
29 #include "llvm/IR/Instruction.h"
30 #include "llvm/IR/Instructions.h"
31 #include "llvm/IR/Intrinsics.h"
32 #include "llvm/IR/Module.h"
33 #include "llvm/IR/Type.h"
34 #include "llvm/IR/ValueHandle.h"
35 #include "llvm/Pass.h"
36 #include "llvm/Support/Casting.h"
37 #include "llvm/Support/Debug.h"
41 #include <cassert>
42 #include <utility>
43 
44 using namespace llvm;
45 
46 #define DEBUG_TYPE "si-annotate-control-flow"
47 
48 namespace {
49 
50 // Complex types used in this pass
51 using StackEntry = std::pair<BasicBlock *, Value *>;
52 using StackVector = SmallVector<StackEntry, 16>;
53 
54 class SIAnnotateControlFlow : public FunctionPass {
56 
57  Type *Boolean;
58  Type *Void;
59  Type *Int64;
60  Type *ReturnStruct;
61 
62  ConstantInt *BoolTrue;
63  ConstantInt *BoolFalse;
64  UndefValue *BoolUndef;
65  Constant *Int64Zero;
66 
67  Function *If;
68  Function *Else;
69  Function *Break;
70  Function *IfBreak;
71  Function *ElseBreak;
72  Function *Loop;
73  Function *EndCf;
74 
75  DominatorTree *DT;
76  StackVector Stack;
77 
78  LoopInfo *LI;
79 
80  bool isUniform(BranchInst *T);
81 
82  bool isTopOfStack(BasicBlock *BB);
83 
84  Value *popSaved();
85 
86  void push(BasicBlock *BB, Value *Saved);
87 
88  bool isElse(PHINode *Phi);
89 
90  void eraseIfUnused(PHINode *Phi);
91 
92  void openIf(BranchInst *Term);
93 
94  void insertElse(BranchInst *Term);
95 
96  Value *
97  handleLoopCondition(Value *Cond, PHINode *Broken, llvm::Loop *L,
98  BranchInst *Term,
99  SmallVectorImpl<WeakTrackingVH> &LoopPhiConditions);
100 
101  void handleLoop(BranchInst *Term);
102 
103  void closeControlFlow(BasicBlock *BB);
104 
105 public:
106  static char ID;
107 
108  SIAnnotateControlFlow() : FunctionPass(ID) {}
109 
110  bool doInitialization(Module &M) override;
111 
112  bool runOnFunction(Function &F) override;
113 
114  StringRef getPassName() const override { return "SI annotate control flow"; }
115 
116  void getAnalysisUsage(AnalysisUsage &AU) const override {
122  }
123 };
124 
125 } // end anonymous namespace
126 
127 INITIALIZE_PASS_BEGIN(SIAnnotateControlFlow, DEBUG_TYPE,
128  "Annotate SI Control Flow", false, false)
131 INITIALIZE_PASS_END(SIAnnotateControlFlow, DEBUG_TYPE,
132  "Annotate SI Control Flow", false, false)
133 
134 char SIAnnotateControlFlow::ID = 0;
135 
136 /// Initialize all the types and constants used in the pass
137 bool SIAnnotateControlFlow::doInitialization(Module &M) {
138  LLVMContext &Context = M.getContext();
139 
140  Void = Type::getVoidTy(Context);
141  Boolean = Type::getInt1Ty(Context);
142  Int64 = Type::getInt64Ty(Context);
143  ReturnStruct = StructType::get(Boolean, Int64);
144 
145  BoolTrue = ConstantInt::getTrue(Context);
146  BoolFalse = ConstantInt::getFalse(Context);
147  BoolUndef = UndefValue::get(Boolean);
148  Int64Zero = ConstantInt::get(Int64, 0);
149 
150  If = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_if);
151  Else = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_else);
152  Break = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_break);
153  IfBreak = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_if_break);
154  ElseBreak = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_else_break);
155  Loop = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_loop);
156  EndCf = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_end_cf);
157  return false;
158 }
159 
160 /// Is the branch condition uniform or did the StructurizeCFG pass
161 /// consider it as such?
162 bool SIAnnotateControlFlow::isUniform(BranchInst *T) {
163  return DA->isUniform(T->getCondition()) ||
164  T->getMetadata("structurizecfg.uniform") != nullptr;
165 }
166 
167 /// Is BB the last block saved on the stack ?
168 bool SIAnnotateControlFlow::isTopOfStack(BasicBlock *BB) {
169  return !Stack.empty() && Stack.back().first == BB;
170 }
171 
172 /// Pop the last saved value from the control flow stack
173 Value *SIAnnotateControlFlow::popSaved() {
174  return Stack.pop_back_val().second;
175 }
176 
177 /// Push a BB and saved value to the control flow stack
178 void SIAnnotateControlFlow::push(BasicBlock *BB, Value *Saved) {
179  Stack.push_back(std::make_pair(BB, Saved));
180 }
181 
182 /// Can the condition represented by this PHI node treated like
183 /// an "Else" block?
184 bool SIAnnotateControlFlow::isElse(PHINode *Phi) {
185  BasicBlock *IDom = DT->getNode(Phi->getParent())->getIDom()->getBlock();
186  for (unsigned i = 0, e = Phi->getNumIncomingValues(); i != e; ++i) {
187  if (Phi->getIncomingBlock(i) == IDom) {
188 
189  if (Phi->getIncomingValue(i) != BoolTrue)
190  return false;
191 
192  } else {
193  if (Phi->getIncomingValue(i) != BoolFalse)
194  return false;
195 
196  }
197  }
198  return true;
199 }
200 
201 // Erase "Phi" if it is not used any more
202 void SIAnnotateControlFlow::eraseIfUnused(PHINode *Phi) {
203  if (RecursivelyDeleteDeadPHINode(Phi)) {
204  LLVM_DEBUG(dbgs() << "Erased unused condition phi\n");
205  }
206 }
207 
208 /// Open a new "If" block
209 void SIAnnotateControlFlow::openIf(BranchInst *Term) {
210  if (isUniform(Term))
211  return;
212 
213  Value *Ret = CallInst::Create(If, Term->getCondition(), "", Term);
214  Term->setCondition(ExtractValueInst::Create(Ret, 0, "", Term));
215  push(Term->getSuccessor(1), ExtractValueInst::Create(Ret, 1, "", Term));
216 }
217 
218 /// Close the last "If" block and open a new "Else" block
219 void SIAnnotateControlFlow::insertElse(BranchInst *Term) {
220  if (isUniform(Term)) {
221  return;
222  }
223  Value *Ret = CallInst::Create(Else, popSaved(), "", Term);
224  Term->setCondition(ExtractValueInst::Create(Ret, 0, "", Term));
225  push(Term->getSuccessor(1), ExtractValueInst::Create(Ret, 1, "", Term));
226 }
227 
228 /// Recursively handle the condition leading to a loop
229 Value *SIAnnotateControlFlow::handleLoopCondition(
230  Value *Cond, PHINode *Broken, llvm::Loop *L, BranchInst *Term,
231  SmallVectorImpl<WeakTrackingVH> &LoopPhiConditions) {
232  // Only search through PHI nodes which are inside the loop. If we try this
233  // with PHI nodes that are outside of the loop, we end up inserting new PHI
234  // nodes outside of the loop which depend on values defined inside the loop.
235  // This will break the module with
236  // 'Instruction does not dominate all users!' errors.
237  PHINode *Phi = nullptr;
238  if ((Phi = dyn_cast<PHINode>(Cond)) && L->contains(Phi)) {
239  BasicBlock *Parent = Phi->getParent();
240  PHINode *NewPhi = PHINode::Create(Int64, 0, "loop.phi", &Parent->front());
241  Value *Ret = NewPhi;
242 
243  // Handle all non-constant incoming values first
244  for (unsigned i = 0, e = Phi->getNumIncomingValues(); i != e; ++i) {
245  Value *Incoming = Phi->getIncomingValue(i);
246  BasicBlock *From = Phi->getIncomingBlock(i);
247  if (isa<ConstantInt>(Incoming)) {
248  NewPhi->addIncoming(Broken, From);
249  continue;
250  }
251 
252  Phi->setIncomingValue(i, BoolFalse);
253  Value *PhiArg = handleLoopCondition(Incoming, Broken, L,
254  Term, LoopPhiConditions);
255  NewPhi->addIncoming(PhiArg, From);
256  }
257 
258  BasicBlock *IDom = DT->getNode(Parent)->getIDom()->getBlock();
259 
260  for (unsigned i = 0, e = Phi->getNumIncomingValues(); i != e; ++i) {
261  Value *Incoming = Phi->getIncomingValue(i);
262  if (Incoming != BoolTrue)
263  continue;
264 
265  BasicBlock *From = Phi->getIncomingBlock(i);
266  if (From == IDom) {
267  // We're in the following situation:
268  // IDom/From
269  // | \
270  // | If-block
271  // | /
272  // Parent
273  // where we want to break out of the loop if the If-block is not taken.
274  // Due to the depth-first traversal, there should be an end.cf
275  // intrinsic in Parent, and we insert an else.break before it.
276  //
277  // Note that the end.cf need not be the first non-phi instruction
278  // of parent, particularly when we're dealing with a multi-level
279  // break, but it should occur within a group of intrinsic calls
280  // at the beginning of the block.
281  CallInst *OldEnd = dyn_cast<CallInst>(Parent->getFirstInsertionPt());
282  while (OldEnd && OldEnd->getCalledFunction() != EndCf)
283  OldEnd = dyn_cast<CallInst>(OldEnd->getNextNode());
284  if (OldEnd && OldEnd->getCalledFunction() == EndCf) {
285  Value *Args[] = { OldEnd->getArgOperand(0), NewPhi };
286  Ret = CallInst::Create(ElseBreak, Args, "", OldEnd);
287  continue;
288  }
289  }
290 
291  TerminatorInst *Insert = From->getTerminator();
292  Value *PhiArg = CallInst::Create(Break, Broken, "", Insert);
293  NewPhi->setIncomingValue(i, PhiArg);
294  }
295 
296  LoopPhiConditions.push_back(WeakTrackingVH(Phi));
297  return Ret;
298  }
299 
300  if (Instruction *Inst = dyn_cast<Instruction>(Cond)) {
301  BasicBlock *Parent = Inst->getParent();
302  Instruction *Insert;
303  if (L->contains(Inst)) {
304  Insert = Parent->getTerminator();
305  } else {
306  Insert = L->getHeader()->getFirstNonPHIOrDbgOrLifetime();
307  }
308 
309  Value *Args[] = { Cond, Broken };
310  return CallInst::Create(IfBreak, Args, "", Insert);
311  }
312 
313  // Insert IfBreak in the loop header TERM for constant COND other than true.
314  if (isa<Constant>(Cond)) {
315  Instruction *Insert = Cond == BoolTrue ?
316  Term : L->getHeader()->getTerminator();
317 
318  Value *Args[] = { Cond, Broken };
319  return CallInst::Create(IfBreak, Args, "", Insert);
320  }
321 
322  llvm_unreachable("Unhandled loop condition!");
323 }
324 
325 /// Handle a back edge (loop)
326 void SIAnnotateControlFlow::handleLoop(BranchInst *Term) {
327  if (isUniform(Term))
328  return;
329 
330  BasicBlock *BB = Term->getParent();
331  llvm::Loop *L = LI->getLoopFor(BB);
332  if (!L)
333  return;
334 
335  BasicBlock *Target = Term->getSuccessor(1);
336  PHINode *Broken = PHINode::Create(Int64, 0, "phi.broken", &Target->front());
337 
338  SmallVector<WeakTrackingVH, 8> LoopPhiConditions;
339  Value *Cond = Term->getCondition();
340  Term->setCondition(BoolTrue);
341  Value *Arg = handleLoopCondition(Cond, Broken, L, Term, LoopPhiConditions);
342 
343  for (BasicBlock *Pred : predecessors(Target))
344  Broken->addIncoming(Pred == BB ? Arg : Int64Zero, Pred);
345 
346  Term->setCondition(CallInst::Create(Loop, Arg, "", Term));
347 
348  for (WeakTrackingVH Val : llvm::reverse(LoopPhiConditions)) {
349  if (PHINode *Cond = cast_or_null<PHINode>(Val))
350  eraseIfUnused(Cond);
351  }
352 
353  push(Term->getSuccessor(0), Arg);
354 }
355 
356 /// Close the last opened control flow
357 void SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) {
358  llvm::Loop *L = LI->getLoopFor(BB);
359 
360  assert(Stack.back().first == BB);
361 
362  if (L && L->getHeader() == BB) {
363  // We can't insert an EndCF call into a loop header, because it will
364  // get executed on every iteration of the loop, when it should be
365  // executed only once before the loop.
367  L->getLoopLatches(Latches);
368 
370  for (BasicBlock *Pred : predecessors(BB)) {
371  if (!is_contained(Latches, Pred))
372  Preds.push_back(Pred);
373  }
374 
375  BB = SplitBlockPredecessors(BB, Preds, "endcf.split", DT, LI, false);
376  }
377 
378  Value *Exec = popSaved();
379  Instruction *FirstInsertionPt = &*BB->getFirstInsertionPt();
380  if (!isa<UndefValue>(Exec) && !isa<UnreachableInst>(FirstInsertionPt))
381  CallInst::Create(EndCf, Exec, "", FirstInsertionPt);
382 }
383 
384 /// Annotate the control flow with intrinsics so the backend can
385 /// recognize if/then/else and loops.
387  DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
388  LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
389  DA = &getAnalysis<DivergenceAnalysis>();
390 
392  E = df_end(&F.getEntryBlock()); I != E; ++I) {
393  BasicBlock *BB = *I;
395 
396  if (!Term || Term->isUnconditional()) {
397  if (isTopOfStack(BB))
398  closeControlFlow(BB);
399 
400  continue;
401  }
402 
403  if (I.nodeVisited(Term->getSuccessor(1))) {
404  if (isTopOfStack(BB))
405  closeControlFlow(BB);
406 
407  handleLoop(Term);
408  continue;
409  }
410 
411  if (isTopOfStack(BB)) {
412  PHINode *Phi = dyn_cast<PHINode>(Term->getCondition());
413  if (Phi && Phi->getParent() == BB && isElse(Phi)) {
414  insertElse(Term);
415  eraseIfUnused(Phi);
416  continue;
417  }
418 
419  closeControlFlow(BB);
420  }
421 
422  openIf(Term);
423  }
424 
425  if (!Stack.empty()) {
426  // CFG was probably not structured.
427  report_fatal_error("failed to annotate CFG");
428  }
429 
430  return true;
431 }
432 
433 /// Create the annotation pass
435  return new SIAnnotateControlFlow();
436 }
static ConstantInt * getFalse(LLVMContext &Context)
Definition: Constants.cpp:584
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static IntegerType * getInt1Ty(LLVMContext &C)
Definition: Type.cpp:173
FunctionPass * createSIAnnotateControlFlowPass()
Create the annotation pass.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
LLVMContext & Context
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
Definition: ilist_node.h:289
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:119
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
INITIALIZE_PASS_BEGIN(SIAnnotateControlFlow, DEBUG_TYPE, "Annotate SI Control Flow", false, false) INITIALIZE_PASS_END(SIAnnotateControlFlow
This class represents a function call, abstracting a target machine&#39;s calling convention.
BasicBlock * getSuccessor(unsigned i) const
F(f)
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:177
Value * getCondition() const
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:51
&#39;undef&#39; values are things that do not have specified contents.
Definition: Constants.h:1275
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
void getLoopLatches(SmallVectorImpl< BlockT *> &LoopLatches) const
Return all loop latch blocks of this loop.
Definition: LoopInfo.h:304
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Definition: Type.cpp:336
BlockT * getHeader() const
Definition: LoopInfo.h:100
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
Definition: STLExtras.h:250
const Instruction * getFirstNonPHIOrDbgOrLifetime() const
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic...
Definition: BasicBlock.cpp:203
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Pass.cpp:92
Value handle that is nullable, but tries to track the Value.
Definition: ValueHandle.h:182
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Definition: Instruction.h:200
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:142
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1007
const BasicBlock & getEntryBlock() const
Definition: Function.h:626
static bool runOnFunction(Function &F, bool PostInlining)
Subclasses of this class are all able to terminate a basic block.
Definition: InstrTypes.h:55
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
Definition: BasicBlock.cpp:218
LLVM Basic Block Representation.
Definition: BasicBlock.h:59
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:69
Conditional or Unconditional Branch instruction.
static ExtractValueInst * Create(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
df_iterator< T > df_end(const T &G)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
Definition: Constant.h:42
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const Instruction & front() const
Definition: BasicBlock.h:276
unsigned char Boolean
Definition: ConvertUTF.h:113
Represent the analysis usage information of a pass.
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:161
Annotate SI Control Flow
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:285
BasicBlock * SplitBlockPredecessors(BasicBlock *BB, ArrayRef< BasicBlock *> Preds, const char *Suffix, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr, bool PreserveLCSSA=false)
This method introduces at least one new basic block into the function and moves some of the predecess...
static UndefValue * get(Type *T)
Static factory methods - Return an &#39;undef&#39; object of the specified type.
Definition: Constants.cpp:1392
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
Definition: LoopInfo.h:110
This is the shared class of boolean and integer constants.
Definition: Constants.h:84
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:847
Module.h This file contains the declarations for the Module class.
bool RecursivelyDeleteDeadPHINode(PHINode *PN, const TargetLibraryInfo *TLI=nullptr)
If the specified value is an effectively dead PHI node, due to being a def-use chain of single-use no...
Definition: Local.cpp:498
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Definition: Constants.cpp:621
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
pred_range predecessors(BasicBlock *BB)
Definition: CFG.h:113
unsigned getNumIncomingValues() const
Return the number of incoming edges.
static ConstantInt * getTrue(LLVMContext &Context)
Definition: Constants.cpp:577
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:133
df_iterator< T > df_begin(const T &G)
Target - Wrapper for Target specific information.
amdgpu Simplify well known AMD library false Value Value * Arg
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:459
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:108
#define I(x, y, z)
Definition: MD5.cpp:58
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:323
bool isUnconditional() const
void setCondition(Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
LLVM Value Representation.
Definition: Value.h:73
The legacy pass manager&#39;s analysis pass to compute loop information.
Definition: LoopInfo.h:964
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:254
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition: BasicBlock.cpp:138
void setIncomingValue(unsigned i, Value *V)
#define LLVM_DEBUG(X)
Definition: Debug.h:119
#define DEBUG_TYPE
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
const BasicBlock * getParent() const
Definition: Instruction.h:67
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:980