This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Remove sext_inreg+add/sub/mul/shl isel patterns.
ClosedPublic

Authored by craig.topper on Aug 8 2021, 12:12 AM.

Details

Summary

Let the sext_inreg be selected to sext.w. Remove unneeded sext.w
during PostProcessISelDAG.

This gives opportunities for some other isel patterns to match
like the ADDIPair or matching mul with immediate to shXadd.

This becomes possible after D107658 started selecting W instructions
based on users. The sext.w will be considered a W user so isel
will often select a W instruction for the sext.w input and we can
just remove the sext.w. Otherwise we can combine the sext.w with
a ADD/SUB/MUL/SLLI to create a new W instruction in parallel
to the the original instruction.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 8 2021, 12:12 AM
craig.topper requested review of this revision.Aug 8 2021, 12:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2021, 12:12 AM
Herald added a subscriber: MaskRay. · View Herald Transcript

Rebase on new tests that have been added.
Factor the new post isel peephole into a helper function.

This revision is now accepted and ready to land.Aug 18 2021, 6:16 AM
This revision was landed with ongoing or failed builds.Aug 18 2021, 11:12 AM
This revision was automatically updated to reflect the committed changes.