This is an archive of the discontinued LLVM Phabricator instance.


Authored by MuellerMP on Feb 2 2023, 2:17 AM.



The glibc and older musl handlers of tlsdesc_dynamic use a cmp instruction which will clobber NZCV.

See glibc's _dl_tlsdesc_dynamic:;a=blob;f=sysdeps/aarch64/dl-tlsdesc.S;hb=refs/heads/release/2.37/master

See v1.1.21 Musl's __tlsdesc_dynamic:

Diff Detail

Event Timeline

MuellerMP created this revision.Feb 2 2023, 2:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 2:17 AM
MuellerMP requested review of this revision.Feb 2 2023, 2:17 AM
MuellerMP retitled this revision from [AArch64] Add NZVC Def for TLSDESC_CALLSEQ to [AArch64] Add NZCV Def for TLSDESC_CALLSEQ.Feb 2 2023, 2:27 AM
MuellerMP updated this revision to Diff 494217.Feb 2 2023, 2:29 AM
MuellerMP updated this revision to Diff 494218.Feb 2 2023, 2:32 AM

This sounds good, as far as I understand. Can you run update_llc_test_checks on the test file to generate the output, perhaps with a comment explaining what it is testing?

MuellerMP updated this revision to Diff 494544.Feb 3 2023, 1:15 AM

Ran update_llc_test_checks on the test and added a comment to it.

MuellerMP added a comment.EditedFeb 3 2023, 1:16 AM

In my research for this case i stumbled over the glibc arm implementation and a TLSDESC RFC targeted towards arm.
They provide information as to why flags is assumed to be clobbered in this case.


I'm not too sure though if a "-stop-after=irtranslator" test for the "implicit-def dead $nzcv" might be a better unit test.
Right now my test seems much more like a integration type of test which asserts the implications of the def.

dmgreen accepted this revision.Feb 6 2023, 12:36 AM

Thanks. LGTM

This revision is now accepted and ready to land.Feb 6 2023, 12:36 AM

Since I don't have commit access, I would appreciate if someone else could commit this.

Oh yeah - can do! What "name <>" should be used for attribution?

MuellerMP added a comment.EditedFeb 13 2023, 7:00 AM

Thanks! You can use: "MuellerMP <>"

This revision was automatically updated to reflect the committed changes.