[PATCH] D128863: Add switch to use "source_file_name" instead of Module ID for globally promoted local

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 14:32:47 PDT 2022


void added a comment.

In D128863#3620768 <https://reviews.llvm.org/D128863#3620768>, @tejohnson wrote:

>> During LTO a local promoted to a global gets a unique suffix based partially on the Module's ID.
>
> The hash is actually a hash of the full module IR, computed when we write out the bitcode before the ThinLTO link, saved in the bitcode file, then read into a table indexed by module Id.
>
>> This has a problem, because the Module ID is not the same as the original Module ID.
>
> Can you clarify what the different module IDs you are comparing here?

I may have a misunderstanding of the module ID. I thought it was based on the name of the Module and not a hash of the full IR. However, the result is the same for the tool we're using. Here're the full details:

- We build the Linux kernel with LTO and PGO enabled.
- Later on, we need to generate a "live-patch" for the kernel (one that'll be applied to the kernel without rebooting it).
- The mechanism we use to generate the live-patch does a large number of checks to determine what changed between the pre and post patched object files.
- Changes in certain sections aren't valid.
  - So if a patched local function "foo" is promoted to a global "foo.llvm.1234567890abcdef", and that function is called from one of the sections where changes are invalid, changing its promoted name (to say "foo.llvm.fedcba0987654321") because of a different Module ID hash causes validation to fail.

So I wanted to avoid this validation muck by not relying upon the Module ID hash, which can apparently change. :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128863/new/

https://reviews.llvm.org/D128863



More information about the llvm-commits mailing list