This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Combine mulo x, 2 -> addo x, x
ClosedPublic

Authored by paquette on Sep 28 2021, 3:09 PM.

Details

Summary

Similar to what SDAG does when it sees a smulo/umulo against 2 (see: DAGCombiner::visitMULO)

This pattern is fairly common in Swift code AFAICT.

Here's an example extracted from a Swift testcase:

https://godbolt.org/z/6cT8Mesx7

Diff Detail

Event Timeline

paquette created this revision.Sep 28 2021, 3:09 PM
paquette requested review of this revision.Sep 28 2021, 3:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2021, 3:09 PM
Herald added a subscriber: wdng. · View Herald Transcript
aemerson accepted this revision.Sep 28 2021, 4:42 PM
This revision is now accepted and ready to land.Sep 28 2021, 4:42 PM
This revision was landed with ongoing or failed builds.Sep 28 2021, 5:00 PM
This revision was automatically updated to reflect the committed changes.