This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner][RISCV] Canonicalize (bswap(bitreverse(x))->bitreverse(bswap(x)).
ClosedPublic

Authored by craig.topper on Jan 23 2022, 7:25 PM.

Details

Summary

If the bitreverse gets expanded, it will introduce a new bswap. By
putting a bswap before the bitreverse, we can ensure it gets cancelled
out when this happens.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 23 2022, 7:25 PM
craig.topper requested review of this revision.Jan 23 2022, 7:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 23 2022, 7:25 PM

Upload whole patch

RKSimon accepted this revision.Jan 24 2022, 2:13 AM

LGTM - cheers

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
9380

Maybe mention its because expandBITREVERSE tries to perform a bswap first?

This revision is now accepted and ready to land.Jan 24 2022, 2:13 AM