[llvm] [BOLT][RISCV] Preserve debug metadata when rewriting call pairs (PR #221116)
Alexander Wilson via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 05:57:53 PDT 2026
rdtscp wrote:
> I think what do you want to fix is similar to this #214721 ?
I think that my (work-in-progress) https://github.com/llvm/llvm-project/pull/221245 is related to that issue (caveat that I don't fully understand that yet. Codex claims its necessary to fix BOLT for my use-case).
This PR is just about fixing the metadata on NOP/AUIPC instructions.
As I understand it, `AUIPC + JALR` instruction pairs are converted to `NOP + PseudoCALL` (for BOLT to create the CFG), and then during re-emit of the re-ordered code the `PseudoCALL` gets translated back to `AUIPC + JALR`, but the NOP still exists and shifts the subsequent instructions by 4 bytes.
As such, we need to move the metadata from the original `AUIPC` to the prepended `NOP` so that BOLT knows where/how to emit the correct DWARF boundaries/source location and offset metadata in the re-emitted binary.
---
This prepended `NOP` already exists in trunk, but seems inefficient to me. Seems like in order to reorder some blocks we are introducing a 1 instruction NOP cost each time. Not sure if this matters in practise, but changing this seems like more work and I don't fully understand the implications
https://github.com/llvm/llvm-project/pull/221116
More information about the llvm-commits
mailing list