This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add DAG combine to pull xor with 1 through select idiom that uses czero_eqz/nez.
ClosedPublic

Authored by craig.topper on Jul 24 2023, 11:34 AM.

Details

Summary

If we are selecting between two setccs that need to be legalized
with xor, the select will be legalized first. Detect this pattern
so we can pull the xor through to expose it to additional
optimizations.

We could generalize this to other operations, but those normally
get handled in DAG combine before select legalization.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 24 2023, 11:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 11:34 AM
craig.topper requested review of this revision.Jul 24 2023, 11:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 11:34 AM
Herald added subscribers: eopXD, MaskRay. · View Herald Transcript
asb accepted this revision.Jul 25 2023, 5:21 AM

LGTM. This definitely solves the problem and it's a small enough piece of code, so happy to go with this solution. Thanks!

This revision is now accepted and ready to land.Jul 25 2023, 5:21 AM
This revision was landed with ongoing or failed builds.Jul 25 2023, 9:14 AM
This revision was automatically updated to reflect the committed changes.