[llvm] [X86] Don't convert local function foo in the same section to foo(%rip) when the offset is near INT32_MIN (PR #98438)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 14:37:59 PDT 2024


MaskRay wrote:

> Let's at least use the same offset as used in isOffsetSuitableForCodeModel - ideally add comments to both locations saying that they are matching estimates (you can pull out the magic number into one location if you want but its not necessary).

Done. I think only `if (isa_and_nonnull<Function>(AM.GV) && AM.Disp < -16 * 1024 * 1024) ` needs a comment where the magic number comes from. Its choice is more flexible and we just arbitrarily pick an extremely conservative threshold. 

The 16MiB magic number in `isOffsetSuitableForCodeModel` could be arbitrarily increased without changing the code modified by this patch.

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


More information about the llvm-commits mailing list