[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 8 09:22:01 PST 2024


AaronBallman wrote:

Thank you for working on this! Improved standards support is always greatly appreciated.

This feature is a bit more complicated than it appears at first. LLVM will often pessimize code in the presence of assumptions and that's the exact opposite of what users will expect from this feature. For example, libc++ removed use of `__builtin_assume` (https://reviews.llvm.org/D153968) because of performance regressions that many folks didn't realize would happen. We ended up having a community discussion about `llvm.assume` and `__builtin_assume` (https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609/) that seemed to have pretty strong support for dropping `llvm.assume` annotations due to how problematic they are in practice. That makes this feature more complicated because it would be strange for us to drop annotations from `__builtin_assume` but then expose them via a standards-based feature.

Rather than re-hash those discussions here on this PR, I think we probably should get some measure of wider community buy-in on what approach to take. @Sirraide, would you be comfortable if you, @erichkeane, and I co-authored an RFC to the community? I'm happy to take the lead on writing the initial draft for it and we can all iterate on it until everyone is comfortable before posting it. (I'm sorry to add the extra layer of work on what would otherwise seem like a straightforward PR, this is a bit of an unusual situation.)

https://github.com/llvm/llvm-project/pull/81014


More information about the cfe-commits mailing list