LLVM  13.0.0git
SIAnnotateControlFlow.cpp
Go to the documentation of this file.
1 //===- SIAnnotateControlFlow.cpp ------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// Annotates the control flow with hardware specific intrinsics.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "AMDGPU.h"
15 #include "GCNSubtarget.h"
17 #include "llvm/Analysis/LoopInfo.h"
19 #include "llvm/IR/BasicBlock.h"
20 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/Dominators.h"
22 #include "llvm/IR/IntrinsicsAMDGPU.h"
23 #include "llvm/InitializePasses.h"
27 
28 using namespace llvm;
29 
30 #define DEBUG_TYPE "si-annotate-control-flow"
31 
32 namespace {
33 
34 // Complex types used in this pass
35 using StackEntry = std::pair<BasicBlock *, Value *>;
36 using StackVector = SmallVector<StackEntry, 16>;
37 
38 class SIAnnotateControlFlow : public FunctionPass {
40 
41  Type *Boolean;
42  Type *Void;
43  Type *IntMask;
44  Type *ReturnStruct;
45 
46  ConstantInt *BoolTrue;
47  ConstantInt *BoolFalse;
48  UndefValue *BoolUndef;
49  Constant *IntMaskZero;
50 
51  Function *If;
52  Function *Else;
53  Function *IfBreak;
54  Function *Loop;
55  Function *EndCf;
56 
57  DominatorTree *DT;
58  StackVector Stack;
59 
60  LoopInfo *LI;
61 
62  void initialize(Module &M, const GCNSubtarget &ST);
63 
64  bool isUniform(BranchInst *T);
65 
66  bool isTopOfStack(BasicBlock *BB);
67 
68  Value *popSaved();
69 
70  void push(BasicBlock *BB, Value *Saved);
71 
72  bool isElse(PHINode *Phi);
73 
74  bool hasKill(const BasicBlock *BB);
75 
76  void eraseIfUnused(PHINode *Phi);
77 
78  void openIf(BranchInst *Term);
79 
80  void insertElse(BranchInst *Term);
81 
82  Value *
83  handleLoopCondition(Value *Cond, PHINode *Broken, llvm::Loop *L,
84  BranchInst *Term);
85 
86  void handleLoop(BranchInst *Term);
87 
88  void closeControlFlow(BasicBlock *BB);
89 
90 public:
91  static char ID;
92 
93  SIAnnotateControlFlow() : FunctionPass(ID) {}
94 
95  bool runOnFunction(Function &F) override;
96 
97  StringRef getPassName() const override { return "SI annotate control flow"; }
98 
99  void getAnalysisUsage(AnalysisUsage &AU) const override {
106  }
107 };
108 
109 } // end anonymous namespace
110 
111 INITIALIZE_PASS_BEGIN(SIAnnotateControlFlow, DEBUG_TYPE,
112  "Annotate SI Control Flow", false, false)
116 INITIALIZE_PASS_END(SIAnnotateControlFlow, DEBUG_TYPE,
117  "Annotate SI Control Flow", false, false)
118 
119 char SIAnnotateControlFlow::ID = 0;
120 
121 /// Initialize all the types and constants used in the pass
122 void SIAnnotateControlFlow::initialize(Module &M, const GCNSubtarget &ST) {
123  LLVMContext &Context = M.getContext();
124 
125  Void = Type::getVoidTy(Context);
127  IntMask = ST.isWave32() ? Type::getInt32Ty(Context)
129  ReturnStruct = StructType::get(Boolean, IntMask);
130 
131  BoolTrue = ConstantInt::getTrue(Context);
132  BoolFalse = ConstantInt::getFalse(Context);
133  BoolUndef = UndefValue::get(Boolean);
134  IntMaskZero = ConstantInt::get(IntMask, 0);
135 
136  If = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_if, { IntMask });
137  Else = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_else,
138  { IntMask, IntMask });
139  IfBreak = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_if_break,
140  { IntMask });
141  Loop = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_loop, { IntMask });
142  EndCf = Intrinsic::getDeclaration(&M, Intrinsic::amdgcn_end_cf, { IntMask });
143 }
144 
145 /// Is the branch condition uniform or did the StructurizeCFG pass
146 /// consider it as such?
147 bool SIAnnotateControlFlow::isUniform(BranchInst *T) {
148  return DA->isUniform(T) ||
149  T->getMetadata("structurizecfg.uniform") != nullptr;
150 }
151 
152 /// Is BB the last block saved on the stack ?
153 bool SIAnnotateControlFlow::isTopOfStack(BasicBlock *BB) {
154  return !Stack.empty() && Stack.back().first == BB;
155 }
156 
157 /// Pop the last saved value from the control flow stack
158 Value *SIAnnotateControlFlow::popSaved() {
159  return Stack.pop_back_val().second;
160 }
161 
162 /// Push a BB and saved value to the control flow stack
164  Stack.push_back(std::make_pair(BB, Saved));
165 }
166 
167 /// Can the condition represented by this PHI node treated like
168 /// an "Else" block?
169 bool SIAnnotateControlFlow::isElse(PHINode *Phi) {
170  BasicBlock *IDom = DT->getNode(Phi->getParent())->getIDom()->getBlock();
171  for (unsigned i = 0, e = Phi->getNumIncomingValues(); i != e; ++i) {
172  if (Phi->getIncomingBlock(i) == IDom) {
173 
174  if (Phi->getIncomingValue(i) != BoolTrue)
175  return false;
176 
177  } else {
178  if (Phi->getIncomingValue(i) != BoolFalse)
179  return false;
180 
181  }
182  }
183  return true;
184 }
185 
186 bool SIAnnotateControlFlow::hasKill(const BasicBlock *BB) {
187  for (const Instruction &I : *BB) {
188  if (const CallInst *CI = dyn_cast<CallInst>(&I))
189  if (CI->getIntrinsicID() == Intrinsic::amdgcn_kill)
190  return true;
191  }
192  return false;
193 }
194 
195 // Erase "Phi" if it is not used any more
196 void SIAnnotateControlFlow::eraseIfUnused(PHINode *Phi) {
197  if (RecursivelyDeleteDeadPHINode(Phi)) {
198  LLVM_DEBUG(dbgs() << "Erased unused condition phi\n");
199  }
200 }
201 
202 /// Open a new "If" block
203 void SIAnnotateControlFlow::openIf(BranchInst *Term) {
204  if (isUniform(Term))
205  return;
206 
207  Value *Ret = CallInst::Create(If, Term->getCondition(), "", Term);
208  Term->setCondition(ExtractValueInst::Create(Ret, 0, "", Term));
209  push(Term->getSuccessor(1), ExtractValueInst::Create(Ret, 1, "", Term));
210 }
211 
212 /// Close the last "If" block and open a new "Else" block
213 void SIAnnotateControlFlow::insertElse(BranchInst *Term) {
214  if (isUniform(Term)) {
215  return;
216  }
217  Value *Ret = CallInst::Create(Else, popSaved(), "", Term);
218  Term->setCondition(ExtractValueInst::Create(Ret, 0, "", Term));
219  push(Term->getSuccessor(1), ExtractValueInst::Create(Ret, 1, "", Term));
220 }
221 
222 /// Recursively handle the condition leading to a loop
223 Value *SIAnnotateControlFlow::handleLoopCondition(
224  Value *Cond, PHINode *Broken, llvm::Loop *L, BranchInst *Term) {
225  if (Instruction *Inst = dyn_cast<Instruction>(Cond)) {
226  BasicBlock *Parent = Inst->getParent();
228  if (L->contains(Inst)) {
229  Insert = Parent->getTerminator();
230  } else {
232  }
233 
234  Value *Args[] = { Cond, Broken };
235  return CallInst::Create(IfBreak, Args, "", Insert);
236  }
237 
238  // Insert IfBreak in the loop header TERM for constant COND other than true.
239  if (isa<Constant>(Cond)) {
240  Instruction *Insert = Cond == BoolTrue ?
241  Term : L->getHeader()->getTerminator();
242 
243  Value *Args[] = { Cond, Broken };
244  return CallInst::Create(IfBreak, Args, "", Insert);
245  }
246 
247  llvm_unreachable("Unhandled loop condition!");
248 }
249 
250 /// Handle a back edge (loop)
251 void SIAnnotateControlFlow::handleLoop(BranchInst *Term) {
252  if (isUniform(Term))
253  return;
254 
255  BasicBlock *BB = Term->getParent();
256  llvm::Loop *L = LI->getLoopFor(BB);
257  if (!L)
258  return;
259 
260  BasicBlock *Target = Term->getSuccessor(1);
261  PHINode *Broken = PHINode::Create(IntMask, 0, "phi.broken", &Target->front());
262 
263  Value *Cond = Term->getCondition();
264  Term->setCondition(BoolTrue);
265  Value *Arg = handleLoopCondition(Cond, Broken, L, Term);
266 
267  for (BasicBlock *Pred : predecessors(Target)) {
268  Value *PHIValue = IntMaskZero;
269  if (Pred == BB) // Remember the value of the previous iteration.
270  PHIValue = Arg;
271  // If the backedge from Pred to Target could be executed before the exit
272  // of the loop at BB, it should not reset or change "Broken", which keeps
273  // track of the number of threads exited the loop at BB.
274  else if (L->contains(Pred) && DT->dominates(Pred, BB))
275  PHIValue = Broken;
276  Broken->addIncoming(PHIValue, Pred);
277  }
278 
279  Term->setCondition(CallInst::Create(Loop, Arg, "", Term));
280 
281  push(Term->getSuccessor(0), Arg);
282 }
283 
284 /// Close the last opened control flow
285 void SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) {
286  llvm::Loop *L = LI->getLoopFor(BB);
287 
288  assert(Stack.back().first == BB);
289 
290  if (L && L->getHeader() == BB) {
291  // We can't insert an EndCF call into a loop header, because it will
292  // get executed on every iteration of the loop, when it should be
293  // executed only once before the loop.
295  L->getLoopLatches(Latches);
296 
298  for (BasicBlock *Pred : predecessors(BB)) {
299  if (!is_contained(Latches, Pred))
300  Preds.push_back(Pred);
301  }
302 
303  BB = SplitBlockPredecessors(BB, Preds, "endcf.split", DT, LI, nullptr,
304  false);
305  }
306 
307  Value *Exec = popSaved();
308  Instruction *FirstInsertionPt = &*BB->getFirstInsertionPt();
309  if (!isa<UndefValue>(Exec) && !isa<UnreachableInst>(FirstInsertionPt)) {
310  Instruction *ExecDef = cast<Instruction>(Exec);
311  BasicBlock *DefBB = ExecDef->getParent();
312  if (!DT->dominates(DefBB, BB)) {
313  // Split edge to make Def dominate Use
314  FirstInsertionPt = &*SplitEdge(DefBB, BB, DT, LI)->getFirstInsertionPt();
315  }
316  CallInst::Create(EndCf, Exec, "", FirstInsertionPt);
317  }
318 }
319 
320 /// Annotate the control flow with intrinsics so the backend can
321 /// recognize if/then/else and loops.
323  DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
324  LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
325  DA = &getAnalysis<LegacyDivergenceAnalysis>();
326  TargetPassConfig &TPC = getAnalysis<TargetPassConfig>();
327  const TargetMachine &TM = TPC.getTM<TargetMachine>();
328 
329  initialize(*F.getParent(), TM.getSubtarget<GCNSubtarget>(F));
330  for (df_iterator<BasicBlock *> I = df_begin(&F.getEntryBlock()),
331  E = df_end(&F.getEntryBlock()); I != E; ++I) {
332  BasicBlock *BB = *I;
333  BranchInst *Term = dyn_cast<BranchInst>(BB->getTerminator());
334 
335  if (!Term || Term->isUnconditional()) {
336  if (isTopOfStack(BB))
337  closeControlFlow(BB);
338 
339  continue;
340  }
341 
342  if (I.nodeVisited(Term->getSuccessor(1))) {
343  if (isTopOfStack(BB))
344  closeControlFlow(BB);
345 
346  if (DT->dominates(Term->getSuccessor(1), BB))
347  handleLoop(Term);
348  continue;
349  }
350 
351  if (isTopOfStack(BB)) {
352  PHINode *Phi = dyn_cast<PHINode>(Term->getCondition());
353  if (Phi && Phi->getParent() == BB && isElse(Phi) && !hasKill(BB)) {
354  insertElse(Term);
355  eraseIfUnused(Phi);
356  continue;
357  }
358 
359  closeControlFlow(BB);
360  }
361 
362  openIf(Term);
363  }
364 
365  if (!Stack.empty()) {
366  // CFG was probably not structured.
367  report_fatal_error("failed to annotate CFG");
368  }
369 
370  return true;
371 }
372 
373 /// Create the annotation pass
375  return new SIAnnotateControlFlow();
376 }
i
i
Definition: README.txt:29
llvm::predecessors
pred_range predecessors(BasicBlock *BB)
Definition: CFG.h:127
llvm
Definition: AllocatorList.h:23
llvm::Type::getInt1Ty
static IntegerType * getInt1Ty(LLVMContext &C)
Definition: Type.cpp:194
llvm::M68kBeads::Term
@ Term
Definition: M68kBaseInfo.h:71
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::SystemZISD::TM
@ TM
Definition: SystemZISelLowering.h:65
llvm::StructType::get
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:366
llvm::Intrinsic::getDeclaration
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:1318
Insert
Vector Rotate Left Mask Mask Insert
Definition: README_P9.txt:112
llvm::BasicBlock::getParent
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:107
llvm::Function
Definition: Function.h:61
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:530
llvm::LoopBase::contains
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
Definition: LoopInfo.h:122
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:124
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::df_end
df_iterator< T > df_end(const T &G)
Definition: DepthFirstIterator.h:223
push
static void push(SmallVectorImpl< uint64_t > &R, StringRef Str)
Definition: BitstreamRemarkSerializer.cpp:23
Local.h
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:151
Saved
Fixup Statepoint Caller Saved
Definition: FixupStatepointCallerSaved.cpp:93
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
llvm::Boolean
unsigned char Boolean
Definition: ConvertUTF.h:112
llvm::LoopInfoWrapperPass
The legacy pass manager's analysis pass to compute loop information.
Definition: LoopInfo.h:1258
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::GCNSubtarget
Definition: GCNSubtarget.h:38
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
initialize
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
Initialize the set of available library functions based on the specified target triple.
Definition: TargetLibraryInfo.cpp:114
llvm::tgtok::Else
@ Else
Definition: TGLexer.h:75
llvm::Type::getInt32Ty
static IntegerType * getInt32Ty(LLVMContext &C)
Definition: Type.cpp:197
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:122
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RecursivelyDeleteDeadPHINode
bool RecursivelyDeleteDeadPHINode(PHINode *PN, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=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:606
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:205
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:77
llvm::LoopBase::getLoopLatches
void getLoopLatches(SmallVectorImpl< BlockT * > &LoopLatches) const
Return all loop latch blocks of this loop.
Definition: LoopInfo.h:334
TargetMachine.h
Constants.h
llvm::PHINode::getIncomingValue
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
Definition: Instructions.h:2668
GCNSubtarget.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::CallInst::Create
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:1493
SI
@ SI
Definition: SIInstrInfo.cpp:7411
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
DEBUG_TYPE
#define DEBUG_TYPE
Definition: SIAnnotateControlFlow.cpp:30
llvm::BasicBlock::getFirstInsertionPt
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:249
false
Definition: StackSlotColoring.cpp:142
llvm::Instruction
Definition: Instruction.h:45
llvm::DominatorTreeWrapperPass
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:281
llvm::report_fatal_error
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:140
llvm::UndefValue::get
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1770
llvm::ConstantInt::get
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:885
llvm::LegacyDivergenceAnalysis
Definition: LegacyDivergenceAnalysis.h:31
llvm::tgtok::If
@ If
Definition: TGLexer.h:51
llvm::SplitBlockPredecessors
BasicBlock * SplitBlockPredecessors(BasicBlock *BB, ArrayRef< BasicBlock * > Preds, const char *Suffix, DominatorTree *DT, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, bool PreserveLCSSA=false)
This method introduces at least one new basic block into the function and moves some of the predecess...
Definition: BasicBlockUtils.cpp:1154
llvm::PHINode::getNumIncomingValues
unsigned getNumIncomingValues() const
Return the number of incoming edges.
Definition: Instructions.h:2664
INITIALIZE_PASS_BEGIN
INITIALIZE_PASS_BEGIN(SIAnnotateControlFlow, DEBUG_TYPE, "Annotate SI Control Flow", false, false) INITIALIZE_PASS_END(SIAnnotateControlFlow
INITIALIZE_PASS_END
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:58
LoopInfo.h
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
BasicBlock.h
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::ExtractValueInst::Create
static ExtractValueInst * Create(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Definition: Instructions.h:2344
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
INITIALIZE_PASS_DEPENDENCY
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
llvm::PHINode::addIncoming
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
Definition: Instructions.h:2722
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::UndefValue
'undef' values are things that do not have specified contents.
Definition: Constants.h:1347
llvm::is_contained
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:1547
TargetPassConfig.h
llvm::df_begin
df_iterator< T > df_begin(const T &G)
Definition: DepthFirstIterator.h:218
llvm::pdb::PDB_MemoryType::Stack
@ Stack
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::M68kBeads::DA
@ DA
Definition: M68kBaseInfo.h:59
llvm::df_iterator
Definition: DepthFirstIterator.h:85
llvm::BasicBlock::getFirstNonPHIOrDbgOrLifetime
const Instruction * getFirstNonPHIOrDbgOrLifetime(bool SkipPseudoOp=false) const
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic,...
Definition: BasicBlock.cpp:233
llvm::LoopInfo
Definition: LoopInfo.h:1080
Control
bool Control
Definition: README.txt:468
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:167
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
AMDGPU.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::AnalysisUsage::addPreserved
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
Definition: PassAnalysisSupport.h:98
llvm::TargetPassConfig::getTM
TMC & getTM() const
Get the right type of TargetMachine for this target.
Definition: TargetPassConfig.h:151
llvm::BasicBlock::getTerminator
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...
Definition: BasicBlock.cpp:148
llvm::ConstantInt::getFalse
static ConstantInt * getFalse(LLVMContext &Context)
Definition: Constants.cpp:840
runOnFunction
static bool runOnFunction(Function &F, bool PostInlining)
Definition: EntryExitInstrumenter.cpp:69
llvm::SplitEdge
BasicBlock * SplitEdge(BasicBlock *From, BasicBlock *To, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, const Twine &BBName="")
Split the edge connecting the specified blocks, and return the newly created basic block between From...
Definition: BasicBlockUtils.cpp:501
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:198
llvm::ConstantInt::getTrue
static ConstantInt * getTrue(LLVMContext &Context)
Definition: Constants.cpp:833
llvm::PHINode::Create
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...
Definition: Instructions.h:2614
llvm::LoopBase::getHeader
BlockT * getHeader() const
Definition: LoopInfo.h:104
llvm::Type::getVoidTy
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:180
LegacyDivergenceAnalysis.h
Flow
Annotate SI Control Flow
Definition: SIAnnotateControlFlow.cpp:117
Dominators.h
llvm::Instruction::getParent
const BasicBlock * getParent() const
Definition: Instruction.h:94
llvm::PHINode::getIncomingBlock
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
Definition: Instructions.h:2688
llvm::PHINode
Definition: Instructions.h:2572
llvm::createSIAnnotateControlFlowPass
FunctionPass * createSIAnnotateControlFlowPass()
Create the annotation pass.
Definition: SIAnnotateControlFlow.cpp:374
llvm::Pass::getAnalysisUsage
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Pass.cpp:93
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
llvm::CallInst
This class represents a function call, abstracting a target machine's calling convention.
Definition: Instructions.h:1450
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::AnalysisUsage::addRequired
AnalysisUsage & addRequired()
Definition: PassAnalysisSupport.h:75
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::BranchInst
Conditional or Unconditional Branch instruction.
Definition: Instructions.h:3007
BasicBlockUtils.h
InitializePasses.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38