[libcxx-commits] [PATCH] D112152: [libc++] Unroll loop in std::find_if and define other std::find variants in terms of it

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 22 10:14:50 PDT 2021


ldionne added a comment.

In D112152#3078415 <https://reviews.llvm.org/D112152#3078415>, @Mordante wrote:

> If the compiler isn't smart enough, how about giving it a hint?
> https://clang.llvm.org/docs/LanguageExtensions.html#loop-unrolling
> Adding `#pragma clang loop unroll_count(4)` to our find causes the loop to unroll
> https://clang.godbolt.org/z/687793Te4

Interesting suggestion actually! The correct comparison would be this: https://clang.godbolt.org/z/PETM1TvrG

I'll wait for @fhahn to provide more context about why we'd want to unroll in the library at all, and then I can apply your suggestions if we decide to move forward.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112152/new/

https://reviews.llvm.org/D112152



More information about the libcxx-commits mailing list