This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG][GlobalISel] Move even divisor optimization for division by constant into UnsignedDivideUsingMagic implementation. NFC
ClosedPublic

Authored by craig.topper on Jan 3 2023, 1:59 PM.

Details

Summary

I've added a bool to UnsignedDivideUsingMagic so we can continue
testing it in the unit test with and without this optimization in
the unit test.

This is a step towards supporting "uncooperative" odd divisors.
See https://ridiculousfish.com/blog/posts/labor-of-division-episode-iii.html

Diff Detail

Event Timeline

craig.topper created this revision.Jan 3 2023, 1:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 1:59 PM
craig.topper requested review of this revision.Jan 3 2023, 1:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 1:59 PM
lebedev.ri accepted this revision.Jan 3 2023, 2:55 PM

Nice cleanup!
Looks good to me.
Thanks.

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
4965

While we are around, can we perhaps give NPQ a more understandable name, or at least a comment somewhere as to what it stands for?

This revision is now accepted and ready to land.Jan 3 2023, 2:55 PM
This revision was landed with ongoing or failed builds.Jan 3 2023, 4:38 PM
This revision was automatically updated to reflect the committed changes.