This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use addi rather than add x0
ClosedPublic

Authored by lenary on Nov 12 2019, 7:26 AM.

Details

Summary

The RISC-V backend used to generate add <reg>, x0, <reg> in a few
instances. It seems most places no longer generate this sequence.

This is semantically equivalent to addi <reg>, <reg>, 0, but the
latter has the advantage of being noted to be the canonical instruction
to be used for moves (which microarchitectures can and should recognise
as such).

The changed testcases use instruction aliases - mv <reg>, <reg> is an
alias for addi <reg>, <reg>, 0.

Diff Detail

Event Timeline

lenary created this revision.Nov 12 2019, 7:26 AM
This revision is now accepted and ready to land.Nov 12 2019, 7:53 AM
This revision was automatically updated to reflect the committed changes.