@@ -1741,30 +1741,7 @@ bool DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
1741
1741
SmallVector<DbgValueLoc, 4 > Values;
1742
1742
for (auto &R : OpenRanges)
1743
1743
Values.push_back (R.second );
1744
-
1745
- // With Basic block sections, it is posssible that the StartLabel and the
1746
- // Instr are not in the same section. This happens when the StartLabel is
1747
- // the function begin label and the dbg value appears in a basic block
1748
- // that is not the entry. In this case, the range needs to be split to
1749
- // span each individual section in the range from StartLabel to EndLabel.
1750
- if (Asm->MF ->hasBBSections () && StartLabel == Asm->getFunctionBegin () &&
1751
- !Instr->getParent ()->sameSection (&Asm->MF ->front ())) {
1752
- const MCSymbol *BeginSectionLabel = StartLabel;
1753
-
1754
- for (const MachineBasicBlock &MBB : *Asm->MF ) {
1755
- if (MBB.isBeginSection () && &MBB != &Asm->MF ->front ())
1756
- BeginSectionLabel = MBB.getSymbol ();
1757
-
1758
- if (MBB.sameSection (Instr->getParent ())) {
1759
- DebugLoc.emplace_back (BeginSectionLabel, EndLabel, Values);
1760
- break ;
1761
- }
1762
- if (MBB.isEndSection ())
1763
- DebugLoc.emplace_back (BeginSectionLabel, MBB.getEndSymbol (), Values);
1764
- }
1765
- } else {
1766
- DebugLoc.emplace_back (StartLabel, EndLabel, Values);
1767
- }
1744
+ DebugLoc.emplace_back (StartLabel, EndLabel, Values);
1768
1745
1769
1746
// Attempt to coalesce the ranges of two otherwise identical
1770
1747
// DebugLocEntries.
@@ -1781,46 +1758,8 @@ bool DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
1781
1758
DebugLoc.pop_back ();
1782
1759
}
1783
1760
1784
- if (!isSafeForSingleLocation ||
1785
- !validThroughout (LScopes, StartDebugMI, EndMI, getInstOrdering ()))
1786
- return false ;
1787
-
1788
- if (DebugLoc.size () == 1 )
1789
- return true ;
1790
-
1791
- if (!Asm->MF ->hasBBSections ())
1792
- return false ;
1793
-
1794
- // Check here to see if loclist can be merged into a single range. If not,
1795
- // we must keep the split loclists per section. This does exactly what
1796
- // MergeRanges does without sections. We don't actually merge the ranges
1797
- // as the split ranges must be kept intact if this cannot be collapsed
1798
- // into a single range.
1799
- const MachineBasicBlock *RangeMBB = nullptr ;
1800
- if (DebugLoc[0 ].getBeginSym () == Asm->getFunctionBegin ())
1801
- RangeMBB = &Asm->MF ->front ();
1802
- else
1803
- RangeMBB = Entries.begin ()->getInstr ()->getParent ();
1804
- auto *CurEntry = DebugLoc.begin ();
1805
- auto *NextEntry = std::next (CurEntry);
1806
- while (NextEntry != DebugLoc.end ()) {
1807
- // Get the last machine basic block of this section.
1808
- while (!RangeMBB->isEndSection ())
1809
- RangeMBB = RangeMBB->getNextNode ();
1810
- if (!RangeMBB->getNextNode ())
1811
- return false ;
1812
- // CurEntry should end the current section and NextEntry should start
1813
- // the next section and the Values must match for these two ranges to be
1814
- // merged.
1815
- if (CurEntry->getEndSym () != RangeMBB->getEndSymbol () ||
1816
- NextEntry->getBeginSym () != RangeMBB->getNextNode ()->getSymbol () ||
1817
- CurEntry->getValues () != NextEntry->getValues ())
1818
- return false ;
1819
- RangeMBB = RangeMBB->getNextNode ();
1820
- CurEntry = NextEntry;
1821
- NextEntry = std::next (CurEntry);
1822
- }
1823
- return true ;
1761
+ return DebugLoc.size () == 1 && isSafeForSingleLocation &&
1762
+ validThroughout (LScopes, StartDebugMI, EndMI, getInstOrdering ());
1824
1763
}
1825
1764
1826
1765
DbgEntity *DwarfDebug::createConcreteEntity (DwarfCompileUnit &TheCU,
0 commit comments