This is an archive of the discontinued LLVM Phabricator instance.

Improve SmallPtrSetImpl::count implementation
ClosedPublic

Authored by serge-sans-paille on May 28 2020, 4:03 AM.

Details

Summary

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.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2020, 4:03 AM
This revision is now accepted and ready to land.May 29 2020, 3:15 AM
This revision was automatically updated to reflect the committed changes.