This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Ensure atomic loads always get assigned GPR destinations
ClosedPublic

Authored by paquette on Sep 14 2021, 10:08 AM.

Details

Summary

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.

Diff Detail

Event Timeline

paquette created this revision.Sep 14 2021, 10:08 AM
paquette requested review of this revision.Sep 14 2021, 10:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2021, 10:08 AM
aemerson accepted this revision.Sep 15 2021, 3:28 PM
aemerson added inline comments.
llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp
760

can use the reference variant: cast<GLoad>(MI).isAtomic()

This revision is now accepted and ready to land.Sep 15 2021, 3:28 PM