This is an archive of the discontinued LLVM Phabricator instance.

[MIPS] Correct the implementation of the msub optimization
ClosedPublic

Authored by sdardis on May 1 2022, 1:06 PM.

Details

Summary

The MIPS backend attempts to combine integer multiply and addition or
subtraction into a madd or msub operation. This optimization is
heavily restricted due to its utility in many cases.

PR/51114 highlighted that the optimization was performed on an
associative basis which is correct in the add case but not in
the sub case.

Resolve this bug by performing an early exit in the case where the
multiply is the LHS operand of the subtraction.

This resolves PR/51114.

Thanks to digitalseraphim for reporting the issue!

Diff Detail

Event Timeline

sdardis created this revision.May 1 2022, 1:06 PM
sdardis requested review of this revision.May 1 2022, 1:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2022, 1:06 PM
atanasyan accepted this revision.May 7 2022, 11:55 PM

LGTM. Thanks.

This revision is now accepted and ready to land.May 7 2022, 11:55 PM
This revision was landed with ongoing or failed builds.May 12 2022, 2:33 PM
This revision was automatically updated to reflect the committed changes.

Thanks for the review.