diff options
author | Martijn Vels <mvels@google.com> | 2020-01-30 14:12:44 -0500 |
---|---|---|
committer | Martijn Vels <mvels@google.com> | 2020-02-26 11:03:51 -0500 |
commit | 07eb82fc06cc41a64d136d046e6b30565c3e5579 (patch) | |
tree | 83c9f8610ecea5ae8d02561f84d31cb55fc9335f /llvm/tools/llvm-diff/DifferenceEngine.cpp | |
parent | 894ce940db5909cf43a428ee9cb4e99b74d9b58e (diff) | |
download | llvm-07eb82fc06cc41a64d136d046e6b30565c3e5579.zip llvm-07eb82fc06cc41a64d136d046e6b30565c3e5579.tar.gz llvm-07eb82fc06cc41a64d136d046e6b30565c3e5579.tar.bz2 |
Add _LIBCPP_BUILTIN_CONSTANT_P support.
Summary:
This change adds the macros _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT and _LIBCPP_BUILTIN_CONSTANT_P to detect compile time constants, and optimze the code accordingly.
A planned usage example:
The implementation of basic_string::assign() can short-cut a compile time known short string assignent into a fast and compact inlined assignment:
```
basic_string::assign(const value_type* __s) {
if (_LIBCPP_BUILTIN_CONSTANT_P(__s[0]) && length(__s) < __min_cap) {
copy(pointer(), _s, length(__s) + 1);
set_size(length(__s));
} else {
// delegate / tail call out of line implementation
}
}
```
Subscribers: christof, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D73732
Diffstat (limited to 'llvm/tools/llvm-diff/DifferenceEngine.cpp')
0 files changed, 0 insertions, 0 deletions