[all-commits] [llvm/llvm-project] f07994: [libc++] Use __builtin_expect and __builtin_assume...

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Mar 29 08:47:18 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0799465b2cc25738d7164774926a8ba3a63b98d
      https://github.com/llvm/llvm-project/commit/f0799465b2cc25738d7164774926a8ba3a63b98d
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2022-03-29 (Tue, 29 Mar 2022)

  Changed paths:
    M libcxx/include/__assert
    A libcxx/test/libcxx/assertions/single_expression.sh.cpp
    M libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp

  Log Message:
  -----------
  [libc++] Use __builtin_expect and __builtin_assume in _LIBCPP_ASSERT

Since we expect the condition to be true most of the time, we might
as well tell the compiler. And when assertions are disabled, we
might as well tell the compiler that it's allowed to assume that
the condition holds.

Differential Revision: https://reviews.llvm.org/D122397




More information about the All-commits mailing list