@@ -2383,6 +2383,8 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
2383
2383
std::pair<uint8_t , SmallVector<const MachineInstr *, 2 >>>
2384
2384
GroupCandidates;
2385
2385
2386
+ const auto &TII = *MF->getSubtarget ().getInstrInfo ();
2387
+
2386
2388
// For each instruction:
2387
2389
// * Skip insts without DebugLoc, AtomGroup or AtomRank, and line zeros.
2388
2390
// * Check if insts in this group have been seen already in GroupCandidates.
@@ -2411,24 +2413,20 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
2411
2413
if (MI.isMetaInstruction ())
2412
2414
continue ;
2413
2415
2414
- if (!MI.getDebugLoc () || !MI.getDebugLoc ().getLine ())
2416
+ const DILocation *Loc = MI.getDebugLoc ().get ();
2417
+ if (!Loc || !Loc->getLine ())
2415
2418
continue ;
2416
2419
2417
2420
// Reset the Buoy to this instruction if it has a different line number.
2418
- if (!Buoy ||
2419
- Buoy->getDebugLoc ().getLine () != MI.getDebugLoc ().getLine ()) {
2421
+ if (!Buoy || Buoy->getDebugLoc ().getLine () != Loc->getLine ()) {
2420
2422
Buoy = &MI;
2421
2423
BuoyAtom = 0 ; // Set later when we know which atom the buoy is used by.
2422
2424
}
2423
2425
2424
2426
// Call instructions are handled specially - we always mark them as key
2425
2427
// regardless of atom info.
2426
- const auto &TII =
2427
- *MI.getParent ()->getParent ()->getSubtarget ().getInstrInfo ();
2428
2428
bool IsCallLike = MI.isCall () || TII.isTailCall (MI);
2429
2429
if (IsCallLike) {
2430
- assert (MI.getDebugLoc () && " Unexpectedly missing DL" );
2431
-
2432
2430
// Calls are always key. Put the buoy (may not be the call) into
2433
2431
// KeyInstructions directly rather than the candidate map to avoid it
2434
2432
// being erased (and we may not have a group number for the call).
@@ -2438,14 +2436,13 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
2438
2436
Buoy = nullptr ;
2439
2437
BuoyAtom = 0 ;
2440
2438
2441
- if (!MI.getDebugLoc ()->getAtomGroup () ||
2442
- !MI.getDebugLoc ()->getAtomRank ())
2439
+ if (!Loc->getAtomGroup () || !Loc->getAtomRank ())
2443
2440
continue ;
2444
2441
}
2445
2442
2446
- auto *InlinedAt = MI. getDebugLoc () ->getInlinedAt ();
2447
- uint64_t Group = MI. getDebugLoc () ->getAtomGroup ();
2448
- uint8_t Rank = MI. getDebugLoc () ->getAtomRank ();
2443
+ auto *InlinedAt = Loc ->getInlinedAt ();
2444
+ uint64_t Group = Loc ->getAtomGroup ();
2445
+ uint8_t Rank = Loc ->getAtomRank ();
2449
2446
if (!Group || !Rank)
2450
2447
continue ;
2451
2448
@@ -2487,8 +2484,8 @@ void DwarfDebug::computeKeyInstructions(const MachineFunction *MF) {
2487
2484
CandidateInsts.push_back (Buoy);
2488
2485
CandidateRank = Rank;
2489
2486
2490
- assert (!BuoyAtom || BuoyAtom == MI. getDebugLoc () ->getAtomGroup ());
2491
- BuoyAtom = MI. getDebugLoc () ->getAtomGroup ();
2487
+ assert (!BuoyAtom || BuoyAtom == Loc ->getAtomGroup ());
2488
+ BuoyAtom = Loc ->getAtomGroup ();
2492
2489
} else {
2493
2490
// Don't add calls, because they've been dealt with already. This means
2494
2491
// CandidateInsts might now be empty - handle that.
0 commit comments