This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Optimize expressions like "return x != 0;" for Thumb1.
ClosedPublic

Authored by efriedma on Mar 20 2019, 2:43 PM.

Details

Summary

There's an existing optimization for x != C, but somehow it was missing a special case for 0.

While I'm here, also cleaned up the code/comments a bit: the second value produced by the MERGE_VALUES was actually dead, since a CMOV only produces one result.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Mar 20 2019, 2:43 PM

Looks like a nice improvement to me.

Can you add some extra testing where the shift is involved?

efriedma updated this revision to Diff 192717.Mar 28 2019, 2:33 PM

Added a couple more tests, including one that generates the subs+sbcs+lsls sequence.

dmgreen accepted this revision.Mar 28 2019, 3:22 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Mar 28 2019, 3:22 PM
This revision was automatically updated to reflect the committed changes.