This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Deprecate llvm::count{Leading,Trailing}{Zeros,Ones} and llvm::countPopulation
ClosedPublic

Authored by kazu on Feb 11 2023, 6:51 PM.

Details

Summary

llvm/include/llvm/ADT/bit.h now has equivalent functions
forward-ported from C++20.

Diff Detail

Event Timeline

kazu created this revision.Feb 11 2023, 6:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2023, 6:51 PM
kazu requested review of this revision.Feb 11 2023, 6:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2023, 6:51 PM

Please take a look. Thanks!

I think the title is incorrect. You're not deprecating llvm::count{pr}_{zero,one}

kazu updated this revision to Diff 496736.Feb 11 2023, 7:43 PM

Updated the description.

kazu retitled this revision from [llvm] Deprecate llvm::count{pr}_{zero,one} and llvm::countPopulation to [llvm] Deprecate llvm::count{Leading,Trailing}{Zeros,Ones} and llvm::countPopulation.Feb 11 2023, 7:44 PM
kazu edited the summary of this revision. (Show Details)

Please take a look. Thanks!

MaskRay accepted this revision.Feb 11 2023, 10:09 PM

Clang diagnostics do not use capitalization or have a trailing period (https://llvm.org/docs/CodingStandards.html#error-and-warning-messages). Conforming to that style will be better, though I do not really care whether it's capitalized or not.

This revision is now accepted and ready to land.Feb 11 2023, 10:09 PM
RKSimon accepted this revision.Feb 12 2023, 2:34 AM
RKSimon added inline comments.
llvm/unittests/Support/MathExtrasTest.cpp
66

I'm not sure what our policy is regarding test coverage - but I'd expect these to stay until we actually remove the functions being tests?

This revision was landed with ongoing or failed builds.Feb 12 2023, 12:12 PM
This revision was automatically updated to reflect the committed changes.
kazu added inline comments.Feb 12 2023, 1:42 PM
llvm/unittests/Support/MathExtrasTest.cpp
66

I think I have to remove these tests. Leaving them would cause warnings, so that would in turn block -Werror builds. In any event, I think the risk is pretty low; I deprecate functions after migrate their uses first.