This is an archive of the discontinued LLVM Phabricator instance.

Compiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE
ClosedPublic

Authored by dexonsmith on Mar 21 2022, 11:48 AM.

Details

Summary

llvm_unreachable() and LLVM_ASSUME_ALIGNED use
defined(LLVM_BUILTIN_UNREACHABLE) to check whether it has a
definition. Remove the fallback added in 26827337dff26ba3 (as a drive-by
when updating the GCC logic) and add a comment to prevent future
mistakes.

Diff Detail

Event Timeline

dexonsmith created this revision.Mar 21 2022, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2022, 11:48 AM
dexonsmith requested review of this revision.Mar 21 2022, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2022, 11:48 AM
aeubanks accepted this revision.Mar 21 2022, 11:49 AM
This revision is now accepted and ready to land.Mar 21 2022, 11:49 AM

Alternatively, maybe we don't support building with compilers that don't have a builtin unreachable anymore, and can have:

#else
#error

and we can simplify logic that depends on this macro... but it seems bit friendlier to keep this alive since it doesn't seem hard.

This revision was landed with ongoing or failed builds.Mar 21 2022, 11:52 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review! Landed in 892c104fb71b86dc6399e36a82ae920e00ccae17.

Alternatively, maybe we don't support building with compilers that don't have a builtin unreachable anymore, and can have:

#else
#error

and we can simplify logic that depends on this macro... but it seems bit friendlier to keep this alive since it doesn't seem hard.

(Can always do that as a follow-up if it makes sense.)