This is an archive of the discontinued LLVM Phabricator instance.

Sanitizers.h - remove MathExtras.h include dependency
ClosedPublic

Authored by RKSimon on Jun 9 2021, 4:01 AM.

Details

Summary

We include the MathExtras.h header purely for the countPopulation() method - by moving this into Sanitizers.cpp we can remove the use of this costly header.

AFAICT we only ever use isPowerOf2() / countPopulation() insider asserts (see the CGExpr.cpp change which I noticed by altering their access to private) so this shouldn't have any performance effects on production code.

Diff Detail

Event Timeline

RKSimon created this revision.Jun 9 2021, 4:01 AM
RKSimon requested review of this revision.Jun 9 2021, 4:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2021, 4:01 AM
RKSimon added inline comments.Jun 9 2021, 4:04 AM
clang/lib/CodeGen/CGExpr.cpp
3129 ↗(On Diff #350845)

I'm happy to revert this line, its purely to demonstrate that the methods are just used in asserts.

pgousseau accepted this revision.Jun 9 2021, 4:12 AM

LGTM!

This revision is now accepted and ready to land.Jun 9 2021, 4:12 AM
This revision was automatically updated to reflect the committed changes.