This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG][GlobalISel] Don't use UnsignedDivisionByConstantInfo for divisor of 1.
ClosedPublic

Authored by craig.topper on Jan 3 2023, 6:43 PM.

Details

Summary

The magic algorithm returns IsAdd indication for division by constant
that we were ignoring.

I considered folding the ignore into UnsignedDivisionByConstantInfo,
but we only allow 1 for vectors of mixed visiors. And really what we
want to end up with is undef. Currently, we get to undef via
DemandedElts optimizations using the select instruction. We could
directly emit undef.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 3 2023, 6:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 6:43 PM
craig.topper requested review of this revision.Jan 3 2023, 6:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 6:43 PM
lebedev.ri accepted this revision.Jan 4 2023, 6:48 AM

LG

llvm/unittests/Support/DivisionByConstantTest.cpp
172
This revision is now accepted and ready to land.Jan 4 2023, 6:48 AM
This revision was landed with ongoing or failed builds.Jan 4 2023, 10:02 AM
This revision was automatically updated to reflect the committed changes.