commit | 38595fb257fee32aaa3b45ff73c3ceaac86e9143 | [log] [tgz] |
---|---|---|
author | Nikolas Klauser <nikolasklauser@berlin.de> | Wed May 07 16:54:34 2025 +0200 |
committer | GitHub <noreply@github.com> | Wed May 07 10:54:34 2025 -0400 |
tree | 824466210fc7c93eeef33ad7223af3719737240e | |
parent | 7d98b66e3d18c0f60e76e20f9ea444c66833b9ba [diff] |
[libc++] Remove a few unnecessary branches from basic_string::find (#137266) I've recently looked at the assembly for `basic_string::find()` and realized that there were a few branches I didn't expect. It turns out that we check for null before calling `__constexpr_memchr` in some cases, which the compiler doesn't optimize away. This is a really uncommon case though, so I'm not convinced it makes a ton of sense to optimize for that. The second case is where `__pos >= __sz`. There, we can instead check `__pos > __sz`, which the optimizer is able to remove if `__pos == 0`, which is also a quite common case (basic_string::find(CharT), without an explicit size parameter).
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.