[AArch64][GlobalISel] Ensure atomic loads always get assigned GPR destinations
authorJessica Paquette <jpaquette@apple.com>
Tue, 14 Sep 2021 17:03:42 +0000 (10:03 -0700)
committerJessica Paquette <jpaquette@apple.com>
Thu, 16 Sep 2021 00:05:09 +0000 (17:05 -0700)
commitc8b3d7d6d6de37af68b2f379d0e37304f78e115f
treed74fb316d92e24ac20d2fec8706a21d1c789c182
parente159d3cbfc250115d1244f3a6219436a52f90f86
[AArch64][GlobalISel] Ensure atomic loads always get assigned GPR destinations

The default register bank selection code for G_LOAD assumes that we ought to
use a FPR when the load is casted to a float/double.

For atomics, this isn't true; we should always use GPRs.

Without this patch, we crash in the following example:

https://godbolt.org/z/MThjas441

Also make the code a little more stylistically consistent while we're here.

Also test some other weird cast combinations as well.

Differential Revision: https://reviews.llvm.org/D109771
llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll