@@ -2081,13 +2081,12 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
2081
2081
2082
2082
// There may be a mixture of scopes using and not using Key Instructions.
2083
2083
// Not-Key-Instructions functions inlined into Key Instructions functions
2084
- // should use not-key is_stmt handling. Key Instructions functions inlined
2085
- // into not-key-instructions functions currently fall back to not-key
2086
- // handling to avoid having to run computeKeyInstructions for all functions
2087
- // (which will impact non-key-instructions builds).
2088
- // TODO: Investigate the performance impact of doing that.
2084
+ // should use not-key is_stmt handling. Key instructions functions inlined
2085
+ // into not-key-instructions functions should use Key Instructions is_stmt
2086
+ // handling.
2089
2087
bool ScopeUsesKeyInstructions =
2090
- KeyInstructionsAreStmts && DL && SP->getKeyInstructionsEnabled ();
2088
+ KeyInstructionsAreStmts && DL &&
2089
+ DL->getScope ()->getSubprogram ()->getKeyInstructionsEnabled ();
2091
2090
2092
2091
bool IsKey = false ;
2093
2092
if (ScopeUsesKeyInstructions && DL && DL.getLine ())
@@ -2663,17 +2662,12 @@ void DwarfDebug::beginFunctionImpl(const MachineFunction *MF) {
2663
2662
PrologEndLoc = emitInitialLocDirective (
2664
2663
*MF, Asm->OutStreamer ->getContext ().getDwarfCompileUnitID ());
2665
2664
2666
- // If this function wasn't built with Key Instructions but has a function
2667
- // inlined into it that was, we treat the inlined instance as if it wasn't
2668
- // built with Key Instructions. If this function was built with Key
2669
- // Instructions but a function inlined into it wasn't then we continue to use
2670
- // Key Instructions for this function and fall back to non-key behaviour for
2671
- // the inlined function (except it doesn't benefit from
2672
- // findForceIsStmtInstrs).
2673
- if (KeyInstructionsAreStmts && SP->getKeyInstructionsEnabled ())
2665
+ // Run both `findForceIsStmtInstrs` and `computeKeyInstructions` because
2666
+ // not-key-instructions functions may be inlined into key-instructions
2667
+ // functions and vice versa.
2668
+ if (KeyInstructionsAreStmts)
2674
2669
computeKeyInstructions (MF);
2675
- else
2676
- findForceIsStmtInstrs (MF);
2670
+ findForceIsStmtInstrs (MF);
2677
2671
}
2678
2672
2679
2673
unsigned
0 commit comments