Page MenuHomePhabricator

[libc++] Use __builtin_unreachable unconditionally
Needs ReviewPublic

Authored by ldionne on Aug 10 2022, 2:27 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

It is implemented by all the compilers that we support. Clang started
supporting it around Clang 4, and GCC around GCC 4.10 if I recall
correctly.

Diff Detail

Unit TestsFailed

TimeTest
80,230 mslibcxx CI C++2b > llvm-libc++-shared-cfg-in.libcxx::transitive_includes.sh.cpp
Script: -- : 'RUN: at line 84'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/0749c4e86a5b-1/llvm-project/libcxx-ci/libcxx/test/libcxx/transitive_includes.sh.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/0749c4e86a5b-1/llvm-project/libcxx-ci/build/generic-cxx2b/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/0749c4e86a5b-1/llvm-project/libcxx-ci/build/generic-cxx2b/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/0749c4e86a5b-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings --trace-includes -fsyntax-only -DTEST_0 2>&1 | /usr/bin/python3.10 /home/libcxx-builder/.buildkite-agent/builds/0749c4e86a5b-1/llvm-project/libcxx-ci/libcxx/test/libcxx/transitive_includes.sanitize.py > /home/libcxx-builder/.buildkite-agent/builds/0749c4e86a5b-1/llvm-project/libcxx-ci/build/generic-cxx2b/test/libcxx/Output/transitive_includes.sh.cpp.dir/t.tmp.actual.algorithm

Event Timeline

ldionne created this revision.Aug 10 2022, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 2:27 PM
ldionne requested review of this revision.Aug 10 2022, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 2:27 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Do we want to abort when in debug mode? While it doesn't give the speed improvements in debug mode it would be really nice to get informed when std::unreachable is reached.

LGTM. I would leave approvals to others