[llvm] [CodeGen] Fix lpad padding at section start after empty block (PR #112595)

Daniel Hoekwater via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 11:25:13 PDT 2024


================
@@ -265,8 +265,22 @@ void llvm::sortBasicBlocksAndUpdateBranches(
 // zero implies "no landing pad." This function inserts a NOP just before the EH
 // pad label to ensure a nonzero offset.
 void llvm::avoidZeroOffsetLandingPad(MachineFunction &MF) {
+  std::optional<MBBSectionID> CurrentSection;
+  bool SectionEmpty = true;
+  auto IsFirstNonEmptyBBInSection = [&](const MachineBasicBlock &MBB) {
----------------
dhoekwater wrote:

Ahh, no you're right, `sortBasicBlocksAndUpdateBranches` guarantees the basic block sections will be contiguous. Looks good!

https://github.com/llvm/llvm-project/pull/112595


More information about the llvm-commits mailing list