Go to the documentation of this file.
24 #define DEBUG_TYPE "replay-inline"
28 std::unique_ptr<InlineAdvisor> OriginalAdvisor,
32 ReplaySettings(ReplaySettings), EmitRemarks(EmitRemarks) {
35 std::error_code EC = BufferOrErr.getError();
46 const std::string PositiveRemark =
"' inlined into '";
47 const std::string NegativeRemark =
"' will not be inlined into '";
51 auto Pair = Line.
split(
" at callsite ");
53 bool IsPositiveRemark =
true;
54 if (Pair.first.contains(NegativeRemark))
55 IsPositiveRemark =
false;
58 Pair.first.split(IsPositiveRemark ? PositiveRemark : NegativeRemark);
61 StringRef Caller = CalleeCaller.second.rsplit(
"'").first;
63 auto CallSite = Pair.second.split(
";").first;
65 if (
Callee.empty() || Caller.empty() || CallSite.empty()) {
70 std::string Combined = (
Callee + CallSite).str();
71 InlineSitesFromRemarks[Combined] = IsPositiveRemark;
73 CallersToReplay.
insert(Caller);
76 HasReplayRemarks =
true;
79 std::unique_ptr<InlineAdvisor>
82 std::unique_ptr<InlineAdvisor> OriginalAdvisor,
85 auto Advisor = std::make_unique<ReplayInlineAdvisor>(
88 if (!Advisor->areReplayRemarksLoaded())
103 return OriginalAdvisor->getAdvice(CB);
109 std::string CallSiteLoc =
112 std::string Combined = (
Callee + CallSiteLoc).str();
115 auto Iter = InlineSitesFromRemarks.
find(Combined);
116 if (Iter != InlineSitesFromRemarks.
end()) {
117 if (InlineSitesFromRemarks[Combined]) {
119 << CallSiteLoc <<
"\n");
120 return std::make_unique<DefaultInlineAdvice>(
125 << CallSiteLoc <<
"\n");
127 return std::make_unique<DefaultInlineAdvice>(
this, CB,
None, ORE,
135 return std::make_unique<DefaultInlineAdvice>(
141 return std::make_unique<DefaultInlineAdvice>(
this, CB,
None, ORE,
148 return OriginalAdvisor->getAdvice(CB);
This is an optimization pass for GlobalISel generic memory operations.
void emitError(uint64_t LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
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
CallSiteFormat ReplayFormat
A forward iterator which reads text lines from a buffer.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
ReplayInlineAdvisor(Module &M, FunctionAnalysisManager &FAM, LLVMContext &Context, std::unique_ptr< InlineAdvisor > OriginalAdvisor, const ReplayInlinerSettings &ReplaySettings, bool EmitRemarks, InlineContext IC)
FunctionAnalysisManager FAM
static InlineCost getAlways(const char *Reason, Optional< CostBenefitPair > CostBenefit=None)
std::pair< typename Base::iterator, bool > insert(StringRef key)
iterator find(StringRef Key)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
Provides context on when an inline advisor is constructed in the pipeline (e.g., link phase,...
Function * getCaller()
Helper to get the caller (the parent function).
std::string formatCallSiteLocation(DebugLoc DLoc, const CallSiteFormat &Format)
Get call site location as a string with the given format.
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
This is an important class for using LLVM in a threaded context.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
Interface for deciding whether to inline a call site or not.
const Function * getFunction() const
Return the function this instruction belongs to.
StringRef getName() const
Return a constant reference to the value's name.
amdgpu Simplify well known AMD library false FunctionCallee Callee
FunctionAnalysisManager & FAM
bool is_at_eof() const
Return true if we've reached EOF or are an "end" iterator.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
std::unique_ptr< InlineAdvice > getAdviceImpl(CallBase &CB) override
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
A container for analyses that lazily runs them and caches their results.
std::unique_ptr< InlineAdvisor > getReplayInlineAdvisor(Module &M, FunctionAnalysisManager &FAM, LLVMContext &Context, std::unique_ptr< InlineAdvisor > OriginalAdvisor, const ReplayInlinerSettings &ReplaySettings, bool EmitRemarks, InlineContext IC)