This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][atomic] Remove workaround for PR31864
ClosedPublic

Authored by lkail on Feb 16 2022, 4:37 AM.

Details

Summary

I believe the origin issue in PR31864 has been addressed by https://reviews.llvm.org/D59566.

As discussed in https://github.com/llvm/llvm-project/issues/53840, ATOMIC_LLONG_LOCK_FREE == 2 sometimes is not consistent with std::atomic<long long>::is_always_lock_free, since the macro takes long long's ABI alignment into account. https://reviews.llvm.org/D28213 proposed we should not rely on ABI alignment of types, thus we have consistent ATOMIC_LLONG_LOCK_FREE and std::atomic<long long>::is_always_lock_free on x86's old cpu. Currently, I plan to move on to remove the workaround which should have been addressed and don't want to break current tests.

Diff Detail

Event Timeline

lkail requested review of this revision.Feb 16 2022, 4:37 AM
lkail created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2022, 4:37 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
lkail updated this revision to Diff 409225.Feb 16 2022, 6:03 AM
ldionne requested changes to this revision.Feb 16 2022, 6:12 AM
ldionne added a subscriber: ldionne.

Looks pretty good, but I think we can dumb it down further.

libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
38

We shouldn't need to check __atomic_always_lock_free at all, we're only trying to test std::atomic<T>::is_always_lock_free.

This revision now requires changes to proceed.Feb 16 2022, 6:12 AM
lkail updated this revision to Diff 409271.Feb 16 2022, 8:10 AM
lkail edited the summary of this revision. (Show Details)
lkail added reviewers: jfb, efriedma, craig.topper.
lkail marked an inline comment as done.
ldionne accepted this revision.EditedMar 4 2022, 9:14 AM

Sorry, this slipped through the cracks. Too many review emails!

Thank you!

This revision is now accepted and ready to land.Mar 4 2022, 9:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 9:14 AM
This revision was automatically updated to reflect the committed changes.

I'm seeing this test fail on 32-bit x86 Linux currently because __CLANG_ATOMIC_LLONG_LOCK_FREE is still 1.

D28213 would probably fix it? It was briefly merged, but it was reverted because it broke FreeBSD. D59566 corrected MaxAtomicInlineWidth for pre-586 CPUs, which should make it possible to remerge D28213.