[Peephole] rewrite INSERT_SUBREG to SUBREG_TO_REG if upper bits zero
authorzhongyunde <zhongyunde@huawei.com>
Fri, 9 Sep 2022 01:00:20 +0000 (09:00 +0800)
committerzhongyunde <zhongyunde@huawei.com>
Fri, 9 Sep 2022 01:00:54 +0000 (09:00 +0800)
commitb6655333c25556d2d9e3a9d73f488d525176d71c
tree383c6df181c4f52d4803dd0b6cd9b5e4c18e8aa2
parent180bf5f9403d42586aedb374d63c72e75a7b7ce3
[Peephole] rewrite INSERT_SUBREG to SUBREG_TO_REG if upper bits zero

Restrict the 32-bit form of an instruction of integer as too many test cases
will be clobber as the register number updated.
    From %reg = INSERT_SUBREG %reg, %subreg, subidx
    To   %reg:subidx =  SUBREG_TO_REG 0, %subreg, subidx
Try to prefix the redundant mov instruction at D132325 as the SUBREG_TO_REG should not generate code.

Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D132939
llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
llvm/test/CodeGen/AArch64/peephole-insert-subreg.mir [new file with mode: 0644]