This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Transform ctpop(Pow2) -> icmp ne Pow2, 0
ClosedPublic

Authored by goldstein.w.n on Jan 20 2023, 1:38 PM.

Details

Summary

This makes folding to 0/1 later on easier and regardless icmp ne is
'probably' faster on most targets (especially for vectors).

Diff Detail

Event Timeline

goldstein.w.n created this revision.Jan 20 2023, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 1:38 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Jan 20 2023, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 1:38 PM
craig.topper added inline comments.
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
677

genrally -> generally

goldstein.w.n marked an inline comment as done.Jan 20 2023, 9:13 PM
nikic accepted this revision.Jan 21 2023, 1:12 AM

LGTM

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
675

If the new pattern reliably subsumes this one, we should drop it in a followup.

This revision is now accepted and ready to land.Jan 21 2023, 1:12 AM
goldstein.w.n added inline comments.Jan 21 2023, 1:17 AM
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
675

If the new pattern reliably subsumes this one, we should drop it in a followup.

Got it. I test removing it but remembered seeing some differences but didn't investigate deeply. I can add a TODO before i commit?

nikic added inline comments.Jan 21 2023, 1:27 AM
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
675

Sure, that's fine.

goldstein.w.n marked 2 inline comments as done.

Add TODO

This revision was landed with ongoing or failed builds.Jan 21 2023, 11:08 PM
This revision was automatically updated to reflect the committed changes.