[RISCV] remove redundant instruction when eliminate frame index
authorluxufan <932494295@qq.com>
Fri, 19 Mar 2021 09:02:28 +0000 (17:02 +0800)
committerluxufan <932494295@qq.com>
Sun, 21 Mar 2021 10:54:00 +0000 (18:54 +0800)
commit02ffbac844e01df2c95dfcb3117213211fe2226d
treefb9fa3dc712883b912466e656aed25964e9c118e
parent297b9bc3fade62b05839b17d970eb48cf10623a3
[RISCV] remove redundant instruction when eliminate frame index

The reason for generating mv a0, a0 instruction is when the stack object offset is large then int<12>. To deal this situation, in the elimintateFrameIndex function, it will
create a virtual register, which needs the register scavenger to scavenge it. If the machine instruction that contains the stack object and the opcode is ADDI(the addi
was generated by frameindexNode), and then this instruction's destination register was the same as the register that was generated by the register scavenger, then the
mv a0, a0 was generated. So to eliminnate this instruction, in the eliminateFrameIndex function, if the instrution opcode is ADDI, then the virtual register can't be created.

Differential Revision: https://reviews.llvm.org/D92479
llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
llvm/test/CodeGen/RISCV/large-stack.ll
llvm/test/CodeGen/RISCV/stack-realignment.ll
llvm/test/CodeGen/RISCV/vararg.ll