This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Don't localize TLS G_GLOBAL_VALUEs on Darwin.
ClosedPublic

Authored by aemerson on Mar 23 2020, 4:59 PM.

Details

Summary

On Darwin these need to be selected into a function call for the TLS address lookup. As a result, they can't be moved below a physreg write, which happens in call sequences. In the long term, we should have some mechanism in the localizer to prevent localizing into target-specific atomic instruction sequences.

rdar://60056248

Diff Detail

Event Timeline

aemerson created this revision.Mar 23 2020, 4:59 PM
paquette added inline comments.Mar 23 2020, 5:45 PM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
13937

Why not Subtarget->isTargetDarwin()?

aemerson marked an inline comment as done.Mar 23 2020, 11:56 PM
aemerson added a subscriber: t.p.northover.
aemerson added inline comments.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
13937

This is the same condition as the one used for determining whether or not we can select TLS globals in the selector. I assumed from @t.p.northover 's implementation that it was a MachO thing rather than specifically Darwin.

volkan accepted this revision.Mar 24 2020, 9:53 AM

LGTM.

llvm/test/CodeGen/AArch64/GlobalISel/localizer-arm64-tti.ll
68

Maybe add a TODO to AArch64TargetLowering::shouldLocalize?

This revision is now accepted and ready to land.Mar 24 2020, 9:53 AM
paquette accepted this revision.Mar 24 2020, 10:15 AM

LGTM too

This revision was automatically updated to reflect the committed changes.