This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][LegalizeTypes] Try to expand BSWAP before promoting if the promoted BSWAP would expand anyway.
ClosedPublic

Authored by craig.topper on Jan 30 2021, 10:46 PM.

Details

Summary

If we're going to end up expanding anyway, we should do it early
so we don't create extra operations to handle the bytes added by
promotion.

This is helfpul on RISCV where we might have to promote i16 all
the way to i64.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 30 2021, 10:46 PM
craig.topper requested review of this revision.Jan 30 2021, 10:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2021, 10:46 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
RKSimon accepted this revision.Jan 31 2021, 2:54 AM

LGTM

llvm/include/llvm/CodeGen/TargetLowering.h
4400

IIRC we handle vector nodes as well? we handle any i16/i32/i64 scalar/vector case - so maybe say something like that?

This revision is now accepted and ready to land.Jan 31 2021, 2:54 AM

Fixup comments in TargetLowering.h to mention vectors. Though I don't think vectors ever reach the code, the code does call getScalarType internally.

luismarques accepted this revision.Jan 31 2021, 2:19 PM

LGTM. Nice!

This revision was landed with ongoing or failed builds.Jan 31 2021, 2:47 PM
This revision was automatically updated to reflect the committed changes.