[llvm] [X86] Refine X86::isOffsetSuitableForCodeModel() (PR #75641)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 10:20:58 PST 2023


================
@@ -515,7 +514,8 @@ define dso_local i32 @load_forced_large_data() #0 {
 ; SMALL-PIC-LABEL: load_forced_large_data:
 ; SMALL-PIC:       # %bb.0:
 ; SMALL-PIC-NEXT:    leaq _GLOBAL_OFFSET_TABLE_(%rip), %rax
-; SMALL-PIC-NEXT:    movl forced_large_data at GOTOFF+8(%rax), %eax
+; SMALL-PIC-NEXT:    movl $8, %ecx
+; SMALL-PIC-NEXT:    movl forced_large_data at GOTOFF(%rax,%rcx), %eax
----------------
rnk wrote:

This code pattern is still wrong, correct? For a known large global, we need to use `movabsq` for the GOT offset, we can't combine it into the symbolic displacement. We *can* combine the fixed offset (8), and we should, because it reduces register pressure, which will matter for the large code model.

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


More information about the llvm-commits mailing list