[X86] Have indirect calls take 64-bit operands in 64-bit modes
authorHarald van Dijk <harald@gigawatt.nl>
Sat, 28 Nov 2020 16:46:30 +0000 (16:46 +0000)
committerHarald van Dijk <harald@gigawatt.nl>
Sat, 28 Nov 2020 16:46:30 +0000 (16:46 +0000)
commit47c902ba8479fc1faed73b86f59d58830df06644
treef2ad7650150106dbdbedeb2be29af185b4ec14b0
parent0aeaec13e76a9b268cafd9b3cd3f24eb922777b0
[X86] Have indirect calls take 64-bit operands in 64-bit modes

The build bots caught two additional pre-existing problems exposed by the test change part of my change https://reviews.llvm.org/D91339, when expensive checks are enabled. This fixes one of them.

X86 has CALL64r and CALL32r opcodes, where CALL64r takes a 64-bit register, and CALL32r takes a 32-bit register. CALL64r can only be used in 64-bit mode, CALL32r can only be used in 32-bit mode. LLVM would assume that after picking the appropriate CALLr opcode, a pointer-sized register would be a valid operand, but in x32 mode, a 64-bit mode, pointers are 32 bits. In this mode, it is invalid to directly pass a pointer to CALL64r, it needs to be extended to 64 bits first.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D91924
llvm/lib/Target/X86/X86FastISel.cpp