This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Do not include <stdatomic.h> from sanitize-thread-disable.c
ClosedPublic

Authored by glider on Aug 23 2021, 6:56 AM.

Details

Summary

[tsan] Do not include <stdatomic.h> from sanitize-thread-disable.c

Looks like non-x86 bots are unhappy with inclusion of <stdatomic.h>
e.g.:

clang-armv7-vfpv3-2stage - https://lab.llvm.org/buildbot/#/builders/182/builds/626
clang-ppc64le-linux - https://lab.llvm.org/buildbot/#/builders/76/builds/3619
llvm-clang-win-x-armv7l - https://lab.llvm.org/buildbot/#/builders/60/builds/4514

It seems to be unnecessary, just remove it and replace atomic_load()
calls with dereferences of _Atomic*.

Diff Detail

Event Timeline

glider created this revision.Aug 23 2021, 6:56 AM
glider requested review of this revision.Aug 23 2021, 6:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2021, 6:56 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Not really sure what's the best solution here, but I think restricting the test to x86 should help.
So far only ARM and PPC bots reported failures.

melver added inline comments.Aug 23 2021, 6:59 AM
clang/test/CodeGen/X86/sanitize-thread-disable.c
22

I think you do not need to use atomic_load.

You can just deref b, and because it's _Atomic type it *should* just use an atomic seq_cst load implicitly.

melver added inline comments.Aug 23 2021, 7:03 AM
clang/test/CodeGen/X86/sanitize-thread-disable.c
22

Alternatively, there are the __atomic builtins. You could just use __atomic_load_n() instead (it works with either _Atomic or non-_Atomic type).

glider updated this revision to Diff 368096.Aug 23 2021, 7:12 AM

Removed the header

clang/test/CodeGen/X86/sanitize-thread-disable.c
22

You are right, turns out I didn't need the header at all. Removed it.

melver accepted this revision.Aug 23 2021, 7:15 AM

LGTM, thanks!

Patch title ("...an X86-only test..") also needs adjustment.

This revision is now accepted and ready to land.Aug 23 2021, 7:15 AM

LGTM, thanks!

Patch title ("...an X86-only test..") also needs adjustment.

It's strange that Phab doesn't automatically update the title when I update the commit message.

glider retitled this revision from [tsan] Make sanitize-thread-disable.c an X86-only test to [tsan] Do not include <stdatomic.h> from sanitize-thread-disable.c.Aug 23 2021, 7:18 AM
glider edited the summary of this revision. (Show Details)

LGTM, thanks!

Patch title ("...an X86-only test..") also needs adjustment.

It's strange that Phab doesn't automatically update the title when I update the commit message.

Hmm, yeah I remember this was broken before. I guess as long as the committed version is right it's fine. I think it's also possible to edit on web interface (not so nice..) and use arc amend or something.

This revision was landed with ongoing or failed builds.Aug 23 2021, 7:24 AM
This revision was automatically updated to reflect the committed changes.