HomePhabricator

[X86] Always use rip-relative addressing on 64-bit when rematerializing all…

Authored by craig.topper on Mar 29 2021, 9:54 AM.

Description

[X86] Always use rip-relative addressing on 64-bit when rematerializing all zeros/ones registers using a folded load.

Previously we only used RIP relative when PIC was enabled. But
we know we're in small/kernel code model here so we should
be able to always use RIP-relative which will give a smaller
encoding.

Here's a godbolt link that demonstrates the current codegen https://godbolt.org/z/j3158o
Note in the non-PIC version the load from .LCPI0_0 doesn't use
RIP-relative addressing, but if you change the constant in the
source from 0.0 to 1.0 it will become RIP-relative.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D97208