@@ -1374,7 +1374,7 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
13741374 OutStreamer->emitULEB128IntValue (MBBSectionRanges.size ());
13751375 }
13761376 // Number of blocks in each MBB section.
1377- MapVector<unsigned , unsigned > MBBSectionNumBlocks;
1377+ MapVector<MBBSectionID , unsigned > MBBSectionNumBlocks;
13781378 const MCSymbol *PrevMBBEndSymbol = nullptr ;
13791379 if (!Features.MultiBBRange ) {
13801380 OutStreamer->AddComment (" function address" );
@@ -1388,7 +1388,7 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
13881388 BBCount++;
13891389 if (MBB.isEndSection ()) {
13901390 // Store each section's basic block count when it ends.
1391- MBBSectionNumBlocks[MBB.getSectionIDNum ()] = BBCount;
1391+ MBBSectionNumBlocks[MBB.getSectionID ()] = BBCount;
13921392 // Reset the count for the next section.
13931393 BBCount = 0 ;
13941394 }
@@ -1404,8 +1404,7 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
14041404 OutStreamer->AddComment (" base address" );
14051405 OutStreamer->emitSymbolValue (MBBSymbol, getPointerSize ());
14061406 OutStreamer->AddComment (" number of basic blocks" );
1407- OutStreamer->emitULEB128IntValue (
1408- MBBSectionNumBlocks[MBB.getSectionIDNum ()]);
1407+ OutStreamer->emitULEB128IntValue (MBBSectionNumBlocks[MBB.getSectionID ()]);
14091408 PrevMBBEndSymbol = MBBSymbol;
14101409 }
14111410 // TODO: Remove this check when version 1 is deprecated.
@@ -1855,7 +1854,9 @@ void AsmPrinter::emitFunctionBody() {
18551854 OutContext);
18561855 OutStreamer->emitELFSize (CurrentSectionBeginSym, SizeExp);
18571856 }
1858- MBBSectionRanges[MBB.getSectionIDNum ()] =
1857+ assert (!MBBSectionRanges.contains (MBB.getSectionID ()) &&
1858+ " Overwrite section range" );
1859+ MBBSectionRanges[MBB.getSectionID ()] =
18591860 MBBSectionRange{CurrentSectionBeginSym, MBB.getEndSymbol ()};
18601861 }
18611862 }
@@ -1972,7 +1973,9 @@ void AsmPrinter::emitFunctionBody() {
19721973 for (auto &Handler : Handlers)
19731974 Handler->markFunctionEnd ();
19741975
1975- MBBSectionRanges[MF->front ().getSectionIDNum ()] =
1976+ assert (!MBBSectionRanges.contains (MF->front ().getSectionID ()) &&
1977+ " Overwrite section range" );
1978+ MBBSectionRanges[MF->front ().getSectionID ()] =
19761979 MBBSectionRange{CurrentFnBegin, CurrentFnEnd};
19771980
19781981 // Print out jump tables referenced by the function.
@@ -2536,7 +2539,7 @@ bool AsmPrinter::doFinalization(Module &M) {
25362539}
25372540
25382541MCSymbol *AsmPrinter::getMBBExceptionSym (const MachineBasicBlock &MBB) {
2539- auto Res = MBBSectionExceptionSyms.try_emplace (MBB.getSectionIDNum ());
2542+ auto Res = MBBSectionExceptionSyms.try_emplace (MBB.getSectionID ());
25402543 if (Res.second )
25412544 Res.first ->second = createTempSymbol (" exception" );
25422545 return Res.first ->second ;
0 commit comments