[llvm] [X86] Do not use movq in -mcmodel=kernel on an out of range abs global (PR #163323)

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 14:20:42 PDT 2025


================
@@ -1256,8 +1256,16 @@ def : Pat<(i64 (X86Wrapper tconstpool  :$dst)),
           (MOV64ri32 tconstpool  :$dst)>, Requires<[KernelCode]>;
 def : Pat<(i64 (X86Wrapper tjumptable  :$dst)),
           (MOV64ri32 tjumptable  :$dst)>, Requires<[KernelCode]>;
-def : Pat<(i64 (X86Wrapper tglobaladdr :$dst)),
-          (MOV64ri32 tglobaladdr :$dst)>, Requires<[KernelCode]>;
+
+// If the globaladdr is an absolute_symbol, don't bother using the sign extending
+// instruction since there's no benefit to using it with absolute symbols.
+def inRange32GlobalAddr : PatLeaf<(tglobaladdr:$dst), [{
----------------
pcc wrote:

Name is inaccurate

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


More information about the llvm-commits mailing list