This is an archive of the discontinued LLVM Phabricator instance.

Use TI.hasBuiltinAtomic() when setting ATOMIC_*_LOCK_FREE values. NFCI
ClosedPublic

Authored by arichardson on Oct 4 2022, 4:31 AM.

Details

Summary

I noticed that the values for __{CLANG,GCC}_ATOMIC_POINTER_LOCK_FREE were
incorrectly set to 1 instead of two in downstream CHERI targets because
pointers are handled specially there. While fixing this downstream, I
noticed that the existing code could be refactored to use
TargetInfo::hasBuiltinAtomic instead of repeating the almost identical
logic. In theory there could be a difference here since hasBuiltinAtomic() also
returns true for types less than 1 char in size, but since
InitializePredefinedMacros() never passes such a value this change should
not introduce any functional changes.

Diff Detail

Event Timeline

arichardson created this revision.Oct 4 2022, 4:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 4:31 AM
arichardson requested review of this revision.Oct 4 2022, 4:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 4:31 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rprichard accepted this revision.Oct 4 2022, 3:26 PM

It looks OK to me, but I wonder if you need someone else to accept it also.

This revision is now accepted and ready to land.Oct 4 2022, 3:26 PM
This revision was landed with ongoing or failed builds.Nov 15 2022, 4:43 AM
This revision was automatically updated to reflect the committed changes.