[llvm] [llvm][IR] Add per-global code model attribute (PR #72077)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 18:12:27 PST 2023


heiher wrote:

@aeubanks Thank you!

After static linking, a `small` code model code is generated to access the `pcpu` variable, which can fully access the `pcpu` variable in the same link unit. The corner issue with kernel modules is that after dynamic linking, the actual location of the `pcpu` variables will be so far away from the code that the default code model (small) doesn't work. This only happens for percpu variables, changing the code model for variables instead of all will help reduce overhead.

I think your original suggestion has better generality, which provides more choices for code models. This allows us to choose a code model that's just right without having to worry about more overhead.

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


More information about the llvm-commits mailing list