@@ -35,35 +35,36 @@ bool canInlineCallBase(CallBase *CB) {
3535 !CB->getAttributes ().hasFnAttr (Attribute::NoInline);
3636}
3737
38- bool attemptInlineFunction (
39- Function &F, CallBase *CB, bool InsertLifetime,
40- function_ref<AAResults &(Function &)> &GetAAR,
41- function_ref<AssumptionCache &(Function &)> &GetAssumptionCache,
42- ProfileSummaryInfo &PSI) {
43- Function *Caller = CB->getCaller ();
44- OptimizationRemarkEmitter ORE (Caller);
45- DebugLoc DLoc = CB->getDebugLoc ();
46- BasicBlock *Block = CB->getParent ();
47-
48- InlineFunctionInfo IFI (GetAssumptionCache, &PSI, nullptr , nullptr );
49- InlineResult Res = InlineFunction (*CB, IFI, /* MergeAttributes=*/ true ,
50- &GetAAR (F), InsertLifetime);
51- if (!Res.isSuccess ()) {
52- ORE.emit ([&]() {
53- return OptimizationRemarkMissed (DEBUG_TYPE, " NotInlined" , DLoc, Block)
54- << " '" << ore::NV (" Callee" , &F) << " ' is not inlined into '"
55- << ore::NV (" Caller" , Caller)
56- << " ': " << ore::NV (" Reason" , Res.getFailureReason ());
57- });
58- return false ;
59- }
38+ bool attemptInlineFunction (
39+ Function &F, CallBase *CB, bool InsertLifetime,
40+ function_ref<AAResults &(Function &)> &GetAAR,
41+ function_ref<AssumptionCache &(Function &)> &GetAssumptionCache,
42+ ProfileSummaryInfo &PSI) {
43+ Function *Caller = CB->getCaller ();
44+ OptimizationRemarkEmitter ORE (Caller);
45+ DebugLoc DLoc = CB->getDebugLoc ();
46+ BasicBlock *Block = CB->getParent ();
47+
48+ InlineFunctionInfo IFI (GetAssumptionCache, &PSI, nullptr , nullptr );
49+ InlineResult Res = InlineFunction (*CB, IFI, /* MergeAttributes=*/ true ,
50+ &GetAAR (F), InsertLifetime);
51+ if (!Res.isSuccess ()) {
52+ ORE.emit ([&]() {
53+ return OptimizationRemarkMissed (DEBUG_TYPE, " NotInlined" , DLoc, Block)
54+ << " '" << ore::NV (" Callee" , &F) << " ' is not inlined into '"
55+ << ore::NV (" Caller" , Caller)
56+ << " ': " << ore::NV (" Reason" , Res.getFailureReason ());
57+ });
58+ return false ;
59+ }
6060
61- emitInlinedIntoBasedOnCost (ORE, DLoc, Block, F, *Caller,
62- InlineCost::getAlways (" always inline attribute" ),
63- /* ForProfileContext=*/ false , DEBUG_TYPE);
61+ emitInlinedIntoBasedOnCost (ORE, DLoc, Block, F, *Caller,
62+ InlineCost::getAlways (" always inline attribute" ),
63+ /* ForProfileContext=*/ false , DEBUG_TYPE);
64+
65+ return true ;
66+ }
6467
65- return true ;
66- }
6768// / This function inlines all functions that are marked with the always_inline
6869// / attribute. It also removes the inlined functions if they are dead after the
6970// / inlining process.
0 commit comments