This is an archive of the discontinued LLVM Phabricator instance.

Add popcount(n) == bitsize(n) -> n == -1 transformation.
ClosedPublic

Authored by deadalnix on Aug 3 2016, 2:25 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

deadalnix updated this revision to Diff 66722.Aug 3 2016, 2:25 PM
deadalnix retitled this revision from to Add popcount(n) == bitsize(n) -> n == -1 transformation..
deadalnix updated this object.
deadalnix added reviewers: majnemer, spatel.
deadalnix added a subscriber: llvm-commits.
spatel accepted this revision.Aug 3 2016, 3:36 PM
spatel edited edge metadata.

LGTM. See inline comments for a couple of nits.

Also, can you please add a vector regression test for more coverage and so we know that we're using the right bitwidth in that case?

lib/Transforms/InstCombine/InstCombineCompares.cpp
2383 ↗(On Diff #66722)

bitwidth(A) - capitalize for consistency

2388 ↗(On Diff #66722)
This revision is now accepted and ready to land.Aug 3 2016, 3:36 PM
deadalnix updated this revision to Diff 66757.Aug 3 2016, 10:31 PM
deadalnix edited edge metadata.

Add test case for vectors
Style nits

This revision was automatically updated to reflect the committed changes.