[llvm] [AArch64][CodeGen] Fix trampoline basic block offset (PR #202716)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 10:49:57 PDT 2026


================
@@ -280,7 +280,9 @@ BranchRelaxation::createNewBlockAfter(MachineBasicBlock &OrigMBB,
   OrigMBB.setIsEndSection(false);
 
   // Insert an entry into BlockInfo to align it properly with the block numbers.
-  BlockInfo.insert(BlockInfo.begin() + NewBB->getNumber(), BasicBlockInfo());
+  auto It = BlockInfo.insert(BlockInfo.begin() + NewBB->getNumber(),
+                             BasicBlockInfo());
+  It->Offset = BlockInfo[OrigMBB.getNumber()].postOffset(*NewBB);
----------------
efriedma-quic wrote:

It looks like most of the users of createNewBlockAfter subsequently end up calling adjustBlockOffsets.  Is this doing redundant work?

More generally, I'd like to make sure we have a consistent convention for when we do these computations, so we don't end up with further issues like this.

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


More information about the llvm-commits mailing list