================ @@ -360,6 +366,25 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) { return true; } +// When the BB address map needs to be generated, this renumbers basic blocks to +// make them appear in increasing order of their IDs in the function. This +// avoids the need to store basic block IDs in the BB address map section, since +// they can be determined implicitly. +bool BasicBlockSections::handleBBAddrMap(MachineFunction &MF) { + if (!MF.getTarget().Options.BBAddrMap) + return false; + MF.RenumberBlocks(); + return true; +} + +bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) { + // First handle the basic block sections. + auto R1 = handleBBSections(MF); + // Handle basic block address map after basic block sections are finalized. + auto R2 = handleBBAddrMap(MF); ---------------- lifengxiang1025 wrote:
If basic-block-sections=labels and basic-block-address-map were used together, doesn't need to run `handleBBAddrMap` https://github.com/llvm/llvm-project/pull/74128 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits