LLVM  16.0.0git
MIRSampleProfile.cpp
Go to the documentation of this file.
1 //===-------- MIRSampleProfile.cpp: MIRSampleFDO (For FSAFDO) -------------===//
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 // This file provides the implementation of the MIRSampleProfile loader, mainly
10 // for flow sensitive SampleFDO.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/ADT/DenseSet.h"
24 #include "llvm/CodeGen/Passes.h"
25 #include "llvm/IR/Function.h"
26 #include "llvm/InitializePasses.h"
28 #include "llvm/Support/Debug.h"
32 
33 using namespace llvm;
34 using namespace sampleprof;
35 using namespace llvm::sampleprofutil;
37 
38 #define DEBUG_TYPE "fs-profile-loader"
39 
41  "show-fs-branchprob", cl::Hidden, cl::init(false),
42  cl::desc("Print setting flow sensitive branch probabilities"));
44  "fs-profile-debug-prob-diff-threshold", cl::init(10),
45  cl::desc("Only show debug message if the branch probility is greater than "
46  "this value (in percentage)."));
47 
49  "fs-profile-debug-bw-threshold", cl::init(10000),
50  cl::desc("Only show debug message if the source branch weight is greater "
51  " than this value."));
52 
53 static cl::opt<bool> ViewBFIBefore("fs-viewbfi-before", cl::Hidden,
54  cl::init(false),
55  cl::desc("View BFI before MIR loader"));
56 static cl::opt<bool> ViewBFIAfter("fs-viewbfi-after", cl::Hidden,
57  cl::init(false),
58  cl::desc("View BFI after MIR loader"));
59 
61 
63  "Load MIR Sample Profile",
64  /* cfg = */ false, /* is_analysis = */ false)
71  /* cfg = */ false, /* is_analysis = */ false)
72 
74 
76  std::string RemappingFile,
78  return new MIRProfileLoaderPass(File, RemappingFile, P);
79 }
80 
81 namespace llvm {
82 
83 // Internal option used to control BFI display only after MBP pass.
84 // Defined in CodeGen/MachineBlockFrequencyInfo.cpp:
85 // -view-block-layout-with-bfi={none | fraction | integer | count}
87 
88 // Command line option to specify the name of the function for CFG dump
89 // Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name=
91 
92 namespace afdo_detail {
93 template <> struct IRTraits<MachineBasicBlock> {
98  using LoopT = MachineLoop;
107  static Function &getFunction(MachineFunction &F) { return F.getFunction(); }
110  }
112  return BB->predecessors();
113  }
115  return BB->successors();
116  }
117 };
118 } // namespace afdo_detail
119 
120 class MIRProfileLoader final
121  : public SampleProfileLoaderBaseImpl<MachineBasicBlock> {
122 public:
126  DT = MDT;
127  PDT = MPDT;
128  LI = MLI;
129  BFI = MBFI;
130  ORE = MORE;
131  }
133  P = Pass;
134  LowBit = getFSPassBitBegin(P);
135  HighBit = getFSPassBitEnd(P);
136  assert(LowBit < HighBit && "HighBit needs to be greater than Lowbit");
137  }
138 
141  }
142 
143  void setBranchProbs(MachineFunction &F);
145  bool doInitialization(Module &M);
146  bool isValid() const { return ProfileIsValid; }
147 
148 protected:
149  friend class SampleCoverageTracker;
150 
151  /// Hold the information of the basic block frequency.
153 
154  /// PassNum is the sequence number this pass is called, start from 1.
156 
157  // LowBit in the FS discriminator used by this instance. Note the number is
158  // 0-based. Base discrimnator use bit 0 to bit 11.
159  unsigned LowBit;
160  // HighwBit in the FS discriminator used by this instance. Note the number
161  // is 0-based.
162  unsigned HighBit;
163 
164  bool ProfileIsValid = true;
165 };
166 
167 template <>
169  MachineBasicBlock>::computeDominanceAndLoopInfo(MachineFunction &F) {}
170 
172  LLVM_DEBUG(dbgs() << "\nPropagation complete. Setting branch probs\n");
173  for (auto &BI : F) {
174  MachineBasicBlock *BB = &BI;
175  if (BB->succ_size() < 2)
176  continue;
177  const MachineBasicBlock *EC = EquivalenceClass[BB];
178  uint64_t BBWeight = BlockWeights[EC];
179  uint64_t SumEdgeWeight = 0;
180  for (MachineBasicBlock *Succ : BB->successors()) {
181  Edge E = std::make_pair(BB, Succ);
182  SumEdgeWeight += EdgeWeights[E];
183  }
184 
185  if (BBWeight != SumEdgeWeight) {
186  LLVM_DEBUG(dbgs() << "BBweight is not equal to SumEdgeWeight: BBWWeight="
187  << BBWeight << " SumEdgeWeight= " << SumEdgeWeight
188  << "\n");
189  BBWeight = SumEdgeWeight;
190  }
191  if (BBWeight == 0) {
192  LLVM_DEBUG(dbgs() << "SKIPPED. All branch weights are zero.\n");
193  continue;
194  }
195 
196 #ifndef NDEBUG
197  uint64_t BBWeightOrig = BBWeight;
198 #endif
200  uint32_t Factor = 1;
201  if (BBWeight > MaxWeight) {
202  Factor = BBWeight / MaxWeight + 1;
203  BBWeight /= Factor;
204  LLVM_DEBUG(dbgs() << "Scaling weights by " << Factor << "\n");
205  }
206 
207  for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),
208  SE = BB->succ_end();
209  SI != SE; ++SI) {
210  MachineBasicBlock *Succ = *SI;
211  Edge E = std::make_pair(BB, Succ);
212  uint64_t EdgeWeight = EdgeWeights[E];
213  EdgeWeight /= Factor;
214 
215  assert(BBWeight >= EdgeWeight &&
216  "BBweight is larger than EdgeWeight -- should not happen.\n");
217 
218  BranchProbability OldProb = BFI->getMBPI()->getEdgeProbability(BB, SI);
219  BranchProbability NewProb(EdgeWeight, BBWeight);
220  if (OldProb == NewProb)
221  continue;
222  BB->setSuccProbability(SI, NewProb);
223 #ifndef NDEBUG
224  if (!ShowFSBranchProb)
225  continue;
226  bool Show = false;
227  BranchProbability Diff;
228  if (OldProb > NewProb)
229  Diff = OldProb - NewProb;
230  else
231  Diff = NewProb - OldProb;
232  Show = (Diff >= BranchProbability(FSProfileDebugProbDiffThreshold, 100));
233  Show &= (BBWeightOrig >= FSProfileDebugBWThreshold);
234 
235  auto DIL = BB->findBranchDebugLoc();
236  auto SuccDIL = Succ->findBranchDebugLoc();
237  if (Show) {
238  dbgs() << "Set branch fs prob: MBB (" << BB->getNumber() << " -> "
239  << Succ->getNumber() << "): ";
240  if (DIL)
241  dbgs() << DIL->getFilename() << ":" << DIL->getLine() << ":"
242  << DIL->getColumn();
243  if (SuccDIL)
244  dbgs() << "-->" << SuccDIL->getFilename() << ":" << SuccDIL->getLine()
245  << ":" << SuccDIL->getColumn();
246  dbgs() << " W=" << BBWeightOrig << " " << OldProb << " --> " << NewProb
247  << "\n";
248  }
249 #endif
250  }
251  }
252 }
253 
255  auto &Ctx = M.getContext();
256 
257  auto ReaderOrErr = sampleprof::SampleProfileReader::create(Filename, Ctx, P,
258  RemappingFilename);
259  if (std::error_code EC = ReaderOrErr.getError()) {
260  std::string Msg = "Could not open profile: " + EC.message();
261  Ctx.diagnose(DiagnosticInfoSampleProfile(Filename, Msg));
262  return false;
263  }
264 
265  Reader = std::move(ReaderOrErr.get());
266  Reader->setModule(&M);
267  ProfileIsValid = (Reader->read() == sampleprof_error::success);
268  Reader->getSummary();
269 
270  return true;
271 }
272 
274  Function &Func = MF.getFunction();
275  clearFunctionData(false);
276  Samples = Reader->getSamplesFor(Func);
277  if (!Samples || Samples->empty())
278  return false;
279 
280  if (getFunctionLoc(MF) == 0)
281  return false;
282 
283  DenseSet<GlobalValue::GUID> InlinedGUIDs;
284  bool Changed = computeAndPropagateWeights(MF, InlinedGUIDs);
285 
286  // Set the new BPI, BFI.
287  setBranchProbs(MF);
288 
289  return Changed;
290 }
291 
292 } // namespace llvm
293 
295  std::string RemappingFileName,
297  : MachineFunctionPass(ID), ProfileFileName(FileName), P(P),
298  MIRSampleLoader(
299  std::make_unique<MIRProfileLoader>(FileName, RemappingFileName)) {
300  LowBit = getFSPassBitBegin(P);
301  HighBit = getFSPassBitEnd(P);
302  assert(LowBit < HighBit && "HighBit needs to be greater than Lowbit");
303 }
304 
305 bool MIRProfileLoaderPass::runOnMachineFunction(MachineFunction &MF) {
306  if (!MIRSampleLoader->isValid())
307  return false;
308 
309  LLVM_DEBUG(dbgs() << "MIRProfileLoader pass working on Func: "
310  << MF.getFunction().getName() << "\n");
311  MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
312  MIRSampleLoader->setInitVals(
313  &getAnalysis<MachineDominatorTree>(),
314  &getAnalysis<MachinePostDominatorTree>(), &getAnalysis<MachineLoopInfo>(),
315  MBFI, &getAnalysis<MachineOptimizationRemarkEmitterPass>().getORE());
316 
317  MF.RenumberBlocks();
319  (ViewBlockFreqFuncName.empty() ||
321  MBFI->view("MIR_Prof_loader_b." + MF.getName(), false);
322  }
323 
324  bool Changed = MIRSampleLoader->runOnFunction(MF);
325  if (Changed)
326  MBFI->calculate(MF, *MBFI->getMBPI(), *&getAnalysis<MachineLoopInfo>());
327 
329  (ViewBlockFreqFuncName.empty() ||
331  MBFI->view("MIR_prof_loader_a." + MF.getName(), false);
332  }
333 
334  return Changed;
335 }
336 
337 bool MIRProfileLoaderPass::doInitialization(Module &M) {
338  LLVM_DEBUG(dbgs() << "MIRProfileLoader pass working on Module " << M.getName()
339  << "\n");
340 
341  MIRSampleLoader->setFSPass(P);
342  return MIRSampleLoader->doInitialization(M);
343 }
344 
345 void MIRProfileLoaderPass::getAnalysisUsage(AnalysisUsage &AU) const {
346  AU.setPreservesAll();
353 }
llvm::getFSPassBitBegin
static unsigned getFSPassBitBegin(FSDiscriminatorPass P)
Definition: Discriminator.h:96
ProfileCount
Function::ProfileCount ProfileCount
Definition: MIRSampleProfile.cpp:36
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1979
llvm::afdo_detail::IRTraits< MachineBasicBlock >::getFunction
static Function & getFunction(MachineFunction &F)
Definition: MIRSampleProfile.cpp:107
llvm::Function
Definition: Function.h:60
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::SampleProfileLoaderBaseImpl
Definition: SampleProfileLoaderBaseImpl.h:81
llvm::MachineOptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: MachineOptimizationRemarkEmitter.h:151
llvm::MachineFunctionPass
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Definition: MachineFunctionPass.h:30
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:139
llvm::MachineBlockFrequencyInfo::view
void view(const Twine &Name, bool isSimple=true) const
Pop up a ghostview window with the current block frequency propagation rendered using dot.
Definition: MachineBlockFrequencyInfo.cpp:224
llvm::afdo_detail::IRTraits< MachineBasicBlock >::getEntryBB
static const MachineBasicBlock * getEntryBB(const MachineFunction *F)
Definition: MIRSampleProfile.cpp:108
llvm::MIRProfileLoader
Definition: MIRSampleProfile.cpp:120
DenseMap.h
llvm::max
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:337
llvm::MIRProfileLoader::BFI
MachineBlockFrequencyInfo * BFI
Hold the information of the basic block frequency.
Definition: MIRSampleProfile.cpp:152
llvm::SPII::Load
@ Load
Definition: SparcInstrInfo.h:32
llvm::MachineFunctionPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Definition: MachineFunctionPass.cpp:167
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::MachineLoopInfo
Definition: MachineLoopInfo.h:89
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::sampleprof::FSDiscriminatorPass
FSDiscriminatorPass
Definition: Discriminator.h:57
CommandLine.h
BlockFrequencyInfoImpl.h
INITIALIZE_PASS_BEGIN
INITIALIZE_PASS_BEGIN(MIRProfileLoaderPass, DEBUG_TYPE, "Load MIR Sample Profile", false, false) INITIALIZE_PASS_END(MIRProfileLoaderPass
MachineLoopInfo.h
llvm::MIRProfileLoader::LowBit
unsigned LowBit
Definition: MIRSampleProfile.cpp:159
llvm::MachineBlockFrequencyInfo
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
Definition: MachineBlockFrequencyInfo.h:33
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MIRProfileLoader::setFSPass
void setFSPass(FSDiscriminatorPass Pass)
Definition: MIRSampleProfile.cpp:132
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
DenseSet.h
false
Definition: StackSlotColoring.cpp:141
llvm::MachineBlockFrequencyInfo::calculate
void calculate(const MachineFunction &F, const MachineBranchProbabilityInfo &MBPI, const MachineLoopInfo &MLI)
calculate - compute block frequency info for the given function.
Definition: MachineBlockFrequencyInfo.cpp:194
llvm::MIRProfileLoaderPass::MIRProfileLoaderPass
MIRProfileLoaderPass(std::string FileName="", std::string RemappingFileName="", FSDiscriminatorPass P=FSDiscriminatorPass::Pass1)
FS bits will only use the '1' bits in the Mask.
Definition: MIRSampleProfile.cpp:294
llvm::MIRProfileLoaderPass
Definition: MIRSampleProfile.h:32
llvm::createMIRProfileLoaderPass
FunctionPass * createMIRProfileLoaderPass(std::string File, std::string RemappingFile, sampleprof::FSDiscriminatorPass P)
Read Flow Sensitive Profile.
Definition: MIRSampleProfile.cpp:75
llvm::MachineOptimizationRemarkAnalysis
Diagnostic information for optimization analysis remarks.
Definition: MachineOptimizationRemarkEmitter.h:109
llvm::MIRProfileLoader::isValid
bool isValid() const
Definition: MIRSampleProfile.cpp:146
SampleProfileLoaderBaseUtil.h
llvm::afdo_detail::IRTraits< MachineBasicBlock >::getPredecessors
static PredRangeT getPredecessors(MachineBasicBlock *BB)
Definition: MIRSampleProfile.cpp:111
FSProfileDebugBWThreshold
static cl::opt< unsigned > FSProfileDebugBWThreshold("fs-profile-debug-bw-threshold", cl::init(10000), cl::desc("Only show debug message if the source branch weight is greater " " than this value."))
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
INITIALIZE_PASS_END
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:58
llvm::StringRef::equals
bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
Definition: StringRef.h:164
MachineOptimizationRemarkEmitter.h
===- MachineOptimizationRemarkEmitter.h - Opt Diagnostics -*- C++ -*-—===//
Passes.h
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
llvm::MachineBasicBlock::succ_iterator
std::vector< MachineBasicBlock * >::iterator succ_iterator
Definition: MachineBasicBlock.h:343
llvm::cl::opt< bool >
llvm::MIRProfileLoader::setInitVals
void setInitVals(MachineDominatorTree *MDT, MachinePostDominatorTree *MPDT, MachineLoopInfo *MLI, MachineBlockFrequencyInfo *MBFI, MachineOptimizationRemarkEmitter *MORE)
Definition: MIRSampleProfile.cpp:123
llvm::MachineLoop
Definition: MachineLoopInfo.h:44
llvm::MIRProfileLoaderPassID
char & MIRProfileLoaderPassID
This pass reads flow sensitive profile.
Definition: MIRSampleProfile.cpp:73
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
uint64_t
llvm::ViewBlockLayoutWithBFI
cl::opt< GVDAGType > ViewBlockLayoutWithBFI("view-block-layout-with-bfi", cl::Hidden, cl::desc("Pop up a window to show a dag displaying MBP layout and associated " "block frequencies of the CFG."), cl::values(clEnumValN(GVDT_None, "none", "do not display graphs."), clEnumValN(GVDT_Fraction, "fraction", "display a graph using the " "fractional block frequency representation."), clEnumValN(GVDT_Integer, "integer", "display a graph using the raw " "integer fractional block frequency representation."), clEnumValN(GVDT_Count, "count", "display a graph using the real " "profile count if available.")))
Definition: MachineBlockPlacement.cpp:214
INITIALIZE_PASS_DEPENDENCY
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
DEBUG_TYPE
#define DEBUG_TYPE
Definition: MIRSampleProfile.cpp:38
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:439
llvm::MachineFunction::getName
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Definition: MachineFunction.cpp:567
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MIRProfileLoader::doInitialization
bool doInitialization(Module &M)
Definition: MIRSampleProfile.cpp:254
MachineBranchProbabilityInfo.h
SI
StandardInstrumentations SI(Debug, VerifyEach)
llvm::MIRProfileLoader::HighBit
unsigned HighBit
Definition: MIRSampleProfile.cpp:162
llvm::sampleprof::SampleProfileReader::create
static ErrorOr< std::unique_ptr< SampleProfileReader > > create(const std::string Filename, LLVMContext &C, FSDiscriminatorPass P=FSDiscriminatorPass::Base, const std::string RemapFilename="")
Create a sample profile reader appropriate to the file format.
Definition: SampleProfReader.cpp:1859
MachinePostDominators.h
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::MIRProfileLoader::runOnFunction
bool runOnFunction(MachineFunction &F)
Definition: MIRSampleProfile.cpp:273
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::DiagnosticInfoSampleProfile
Diagnostic information for the sample profiler.
Definition: DiagnosticInfo.h:291
llvm::MachineBasicBlock::getNumber
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
Definition: MachineBasicBlock.h:1115
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::MachineBasicBlock::findBranchDebugLoc
DebugLoc findBranchDebugLoc()
Find and return the merged DebugLoc of the branch instructions of the block.
Definition: MachineBasicBlock.cpp:1426
llvm::MachineOptimizationRemarkEmitterPass
The analysis pass.
Definition: MachineOptimizationRemarkEmitter.h:219
uint32_t
llvm::BranchProbability
Definition: BranchProbability.h:30
Profile
Load MIR Sample Profile
Definition: MIRSampleProfile.cpp:70
SampleProfileLoaderBaseImpl.h
llvm::AMDGPUISD::BFI
@ BFI
Definition: AMDGPUISelLowering.h:429
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:308
FSProfileDebugProbDiffThreshold
static cl::opt< unsigned > FSProfileDebugProbDiffThreshold("fs-profile-debug-prob-diff-threshold", cl::init(10), cl::desc("Only show debug message if the branch probility is greater than " "this value (in percentage)."))
MORE
#define MORE()
Definition: regcomp.c:252
llvm::MachinePostDominatorTree
MachinePostDominatorTree - an analysis pass wrapper for DominatorTree used to compute the post-domina...
Definition: MachinePostDominators.h:27
llvm::sampleprofutil
Definition: SampleProfileLoaderBaseUtil.h:33
llvm::AMDGPU::SendMsg::Msg
const CustomOperand< const MCSubtargetInfo & > Msg[]
Definition: AMDGPUAsmUtils.cpp:39
llvm::MIRProfileLoader::P
FSDiscriminatorPass P
PassNum is the sequence number this pass is called, start from 1.
Definition: MIRSampleProfile.cpp:155
runOnFunction
static bool runOnFunction(Function &F, bool PostInlining)
Definition: EntryExitInstrumenter.cpp:69
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
std
Definition: BitVector.h:851
MIRSampleProfile.h
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:622
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::afdo_detail::IRTraits< MachineBasicBlock >::getSuccessors
static SuccRangeT getSuccessors(MachineBasicBlock *BB)
Definition: MIRSampleProfile.cpp:114
llvm::MIRProfileLoader::setBranchProbs
void setBranchProbs(MachineFunction &F)
Definition: MIRSampleProfile.cpp:171
Function.h
llvm::MIRProfileLoaderPass::ID
static char ID
Definition: MIRSampleProfile.h:40
llvm::sampleprofutil::SampleCoverageTracker
Definition: SampleProfileLoaderBaseUtil.h:35
ViewBFIBefore
static cl::opt< bool > ViewBFIBefore("fs-viewbfi-before", cl::Hidden, cl::init(false), cl::desc("View BFI before MIR loader"))
llvm::sampleprof_error::success
@ success
llvm::Pass
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:91
llvm::SampleProfileLoaderBaseImpl< MachineBasicBlock >::Edge
std::pair< const BasicBlockT *, const BasicBlockT * > Edge
Definition: SampleProfileLoaderBaseImpl.h:110
llvm::GVDT_None
@ GVDT_None
Definition: BlockFrequencyInfoImpl.h:1805
llvm::afdo_detail::IRTraits
Definition: SampleProfileLoaderBaseImpl.h:53
llvm::MachineBlockFrequencyInfo::getMBPI
const MachineBranchProbabilityInfo * getMBPI() const
Definition: MachineBlockFrequencyInfo.cpp:273
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::AnalysisUsage::addRequiredTransitive
AnalysisUsage & addRequiredTransitive()
Definition: PassAnalysisSupport.h:81
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:308
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::getFSPassBitEnd
static unsigned getFSPassBitEnd(FSDiscriminatorPass P)
Definition: Discriminator.h:89
llvm::ViewBlockFreqFuncName
cl::opt< std::string > ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden, cl::desc("The option to specify " "the name of the function " "whose CFG will be displayed."))
Definition: MachineBlockFrequencyInfo.cpp:66
llvm::AnalysisUsage::addRequired
AnalysisUsage & addRequired()
Definition: PassAnalysisSupport.h:75
llvm::GraphTraits
Definition: GraphTraits.h:37
llvm::Function::ProfileCount
Class to represent profile counts.
Definition: Function.h:253
ViewBFIAfter
static cl::opt< bool > ViewBFIAfter("fs-viewbfi-after", cl::Hidden, cl::init(false), cl::desc("View BFI after MIR loader"))
llvm::cl::desc
Definition: CommandLine.h:412
raw_ostream.h
llvm::MachineDominatorTree
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Definition: MachineDominators.h:51
llvm::MIRProfileLoader::MIRProfileLoader
MIRProfileLoader(StringRef Name, StringRef RemapName)
Definition: MIRSampleProfile.cpp:139
ShowFSBranchProb
static cl::opt< bool > ShowFSBranchProb("show-fs-branchprob", cl::Hidden, cl::init(false), cl::desc("Print setting flow sensitive branch probabilities"))
InitializePasses.h
MachineBlockFrequencyInfo.h
Debug.h
llvm::MachineFunction::RenumberBlocks
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them.
Definition: MachineFunction.cpp:319
SpecialSubKind::string
@ string
MachineDominators.h