AArch64: do not use xzr for ldxp -> stxp dataflow.
authorTim Northover <tnorthover@apple.com>
Wed, 9 Feb 2022 11:42:36 +0000 (11:42 +0000)
committerTim Northover <tnorthover@apple.com>
Wed, 9 Feb 2022 12:29:16 +0000 (12:29 +0000)
commit00e372137c8a604b59b995131cebf2d84f097544
treeb2ee068dac790f7e54417ab02fdb6106ac921507
parent3fc40b6e6628cd3206d5aaf2bfb864add7d74fe1
AArch64: do not use xzr for ldxp -> stxp dataflow.

If the result of a cmpxchg is unused, regalloc chooses `xzr` for the defs of
CMP_SWAP_128*. However, on the failure path this gets expanded to a LDXP ->
STXP to store the original value (to ensure no tearing occurred). This
unintentionally nulls out half of the value.

So instead use GPR64common for these defs, so regalloc has to choose a real
one.
llvm/lib/Target/AArch64/AArch64InstrAtomics.td
llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmpxchg-128.mir
llvm/test/CodeGen/AArch64/arm64-atomic-128.ll