This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fold ARMISD::ADDC with no carry uses to ISD::ADD
Changes PlannedPublic

Authored by dmgreen on Sep 10 2021, 2:41 AM.

Details

Summary

An ARMISD::ADDC (which is really an ADDS), for which the flags (second output value) are never used is equivalent to a normal ADD. Same goes for ARMISD:SUBC -> SUB, which helps prevent an infinite loop during DAG combining.

Diff Detail

Event Timeline

dmgreen created this revision.Sep 10 2021, 2:41 AM
dmgreen requested review of this revision.Sep 10 2021, 2:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2021, 2:41 AM
efriedma accepted this revision.Sep 10 2021, 11:24 AM

LGTM. (please clang-format patch before merging.)

This revision is now accepted and ready to land.Sep 10 2021, 11:24 AM
dmgreen planned changes to this revision.Sep 15 2021, 3:24 AM

I missed a couple of tests here, where uadd.sat is a little worse now as it does not realize it can fold conditions any more after creating add, as opposed to adds.

In the meantime, before that is fixed, I've put a simpler fix in a2332d5332c3ede49adf1c71481e9efab7ca88c7 to prevent the infinite combining.