@@ -2405,6 +2405,8 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
24052405 std::pair<uint8_t , SmallVector<const MachineInstr *, 2 >>>
24062406 GroupCandidates;
24072407
2408+ const auto &TII = *MF->getSubtarget ().getInstrInfo ();
2409+
24082410 // For each instruction:
24092411 // * Skip insts without DebugLoc, AtomGroup or AtomRank, and line zeros.
24102412 // * Check if insts in this group have been seen already in GroupCandidates.
@@ -2433,24 +2435,20 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
24332435 if (MI.isMetaInstruction ())
24342436 continue ;
24352437
2436- if (!MI.getDebugLoc () || !MI.getDebugLoc ().getLine ())
2438+ const DILocation *Loc = MI.getDebugLoc ().get ();
2439+ if (!Loc || !Loc->getLine ())
24372440 continue ;
24382441
24392442 // Reset the Buoy to this instruction if it has a different line number.
2440- if (!Buoy ||
2441- Buoy->getDebugLoc ().getLine () != MI.getDebugLoc ().getLine ()) {
2443+ if (!Buoy || Buoy->getDebugLoc ().getLine () != Loc->getLine ()) {
24422444 Buoy = &MI;
24432445 BuoyAtom = 0 ; // Set later when we know which atom the buoy is used by.
24442446 }
24452447
24462448 // Call instructions are handled specially - we always mark them as key
24472449 // regardless of atom info.
2448- const auto &TII =
2449- *MI.getParent ()->getParent ()->getSubtarget ().getInstrInfo ();
24502450 bool IsCallLike = MI.isCall () || TII.isTailCall (MI);
24512451 if (IsCallLike) {
2452- assert (MI.getDebugLoc () && " Unexpectedly missing DL" );
2453-
24542452 // Calls are always key. Put the buoy (may not be the call) into
24552453 // KeyInstructions directly rather than the candidate map to avoid it
24562454 // being erased (and we may not have a group number for the call).
@@ -2460,14 +2458,13 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
24602458 Buoy = nullptr ;
24612459 BuoyAtom = 0 ;
24622460
2463- if (!MI.getDebugLoc ()->getAtomGroup () ||
2464- !MI.getDebugLoc ()->getAtomRank ())
2461+ if (!Loc->getAtomGroup () || !Loc->getAtomRank ())
24652462 continue ;
24662463 }
24672464
2468- auto *InlinedAt = MI. getDebugLoc () ->getInlinedAt ();
2469- uint64_t Group = MI. getDebugLoc () ->getAtomGroup ();
2470- uint8_t Rank = MI. getDebugLoc () ->getAtomRank ();
2465+ auto *InlinedAt = Loc ->getInlinedAt ();
2466+ uint64_t Group = Loc ->getAtomGroup ();
2467+ uint8_t Rank = Loc ->getAtomRank ();
24712468 if (!Group || !Rank)
24722469 continue ;
24732470
@@ -2509,8 +2506,8 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
25092506 CandidateInsts.push_back (Buoy);
25102507 CandidateRank = Rank;
25112508
2512- assert (!BuoyAtom || BuoyAtom == MI. getDebugLoc () ->getAtomGroup ());
2513- BuoyAtom = MI. getDebugLoc () ->getAtomGroup ();
2509+ assert (!BuoyAtom || BuoyAtom == Loc ->getAtomGroup ());
2510+ BuoyAtom = Loc ->getAtomGroup ();
25142511 } else {
25152512 // Don't add calls, because they've been dealt with already. This means
25162513 // CandidateInsts might now be empty - handle that.
0 commit comments