[all-commits] [llvm/llvm-project] 11efb0: Improve SmallPtrSetImpl::count implementation

serge-sans-paille via All-commits all-commits at lists.llvm.org
Sun May 31 22:52:02 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 11efb0837c897c709ae162eb5ebabb460fc537ff
      https://github.com/llvm/llvm-project/commit/11efb0837c897c709ae162eb5ebabb460fc537ff
  Author: serge-sans-paille <sguelton at redhat.com>
  Date:   2020-06-01 (Mon, 01 Jun 2020)

  Changed paths:
    M llvm/include/llvm/ADT/SmallPtrSet.h

  Log Message:
  -----------
  Improve SmallPtrSetImpl::count implementation

Relying on the find method implies a roundtrip to the iterator world, which is
not costless because iterator creation involves a few check to ensure the
iterator is in a valid position (through the SmallPtrSetIteratorImpl::AdvanceIfNotValid
method). It turns out that the result of SmallPtrSetImpl::find_imp is either
valid or the EndPointer, so there's no need to go through that abstraction,
and the compiler cannot guess it.

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




More information about the All-commits mailing list