Page MenuHomePhabricator

[libc++] Inline small constructors into basic_string
ClosedPublic

Authored by philnik on Feb 22 2023, 11:16 AM.

Details

Summary

This allows the compiler to inline the constructors.

Diff Detail

Unit TestsFailed

TimeTest
270 mslibcxx CI No exceptions > llvm-libc++-shared-cfg-in.std/language_support/support_dynamic/new_delete/new_delete_array::new_align_val_t_nothrow.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-17 /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -fno-exceptions -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -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 -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/test/std/language.support/support.dynamic/new.delete/new.delete.array/Output/new_align_val_t_nothrow.pass.cpp.dir/t.tmp.exe
270 mslibcxx CI No exceptions > llvm-libc++-shared-cfg-in.std/language_support/support_dynamic/new_delete/new_delete_array::new_array_nothrow.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-17 /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -fno-exceptions -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -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 -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/test/std/language.support/support.dynamic/new.delete/new.delete.array/Output/new_array_nothrow.pass.cpp.dir/t.tmp.exe
270 mslibcxx CI No exceptions > llvm-libc++-shared-cfg-in.std/language_support/support_dynamic/new_delete/new_delete_single::new_align_val_t_nothrow.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-17 /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -fno-exceptions -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -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 -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/test/std/language.support/support.dynamic/new.delete/new.delete.single/Output/new_align_val_t_nothrow.pass.cpp.dir/t.tmp.exe
270 mslibcxx CI No exceptions > llvm-libc++-shared-cfg-in.std/language_support/support_dynamic/new_delete/new_delete_single::new_nothrow.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/clang++-17 /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -fno-exceptions -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -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 -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/eeef97b651a0-1/llvm-project/libcxx-ci/build/generic-noexceptions/test/std/language.support/support.dynamic/new.delete/new.delete.single/Output/new_nothrow.pass.cpp.dir/t.tmp.exe

Event Timeline

philnik created this revision.Feb 22 2023, 11:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2023, 11:16 AM
philnik requested review of this revision.Feb 22 2023, 11:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2023, 11:16 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante edited the summary of this revision. (Show Details)Feb 25 2023, 5:19 AM

In general I like this. Did you see a change in binary size or performance with this change?

libcxx/include/string
1003

Has this change an effect due to the _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS?

1064–1068

This changes the indention.

philnik marked an inline comment as done.Feb 25 2023, 6:16 AM

In general I like this. Did you see a change in binary size or performance with this change?

I don't have a large code base to check, but here is a small example: https://godbolt.org/z/oYj76b78K (everything is implicitly inline because of constexpr in C++20)

libcxx/include/string
1003

No, I missed these ones in D128081.

In general I like this. Did you see a change in binary size or performance with this change?

I don't have a large code base to check, but here is a small example: https://godbolt.org/z/oYj76b78K (everything is implicitly inline because of constexpr in C++20)

This looks nice :-)

I see the patch failed to apply in the CI, can you fix that?

No other comments, but I like to see a CI run before approving.

libcxx/include/string
1003

Thanks.

philnik updated this revision to Diff 500554.Feb 26 2023, 5:35 AM
philnik marked an inline comment as done.

Rebased

ldionne accepted this revision.Feb 27 2023, 9:55 AM

LGTM w/ green CI.

This revision is now accepted and ready to land.Feb 27 2023, 9:55 AM
This revision was landed with ongoing or failed builds.Mar 19 2023, 9:53 AM
This revision was automatically updated to reflect the committed changes.