[AArch64] Remove redundant `mov 0` instruction for high 64-bits
authorJingu Kang <jingu.kang@arm.com>
Mon, 3 Apr 2023 08:25:09 +0000 (09:25 +0100)
committerJingu Kang <jingu.kang@arm.com>
Mon, 3 Apr 2023 09:39:54 +0000 (10:39 +0100)
commit932911d6b10a7503a0b9c5e1a2ddb581cc3421bf
tree63dd58296ee0afb3d2335b5ba74fff2f31d2f0e1
parentcc26222eb4a68b388e2ad9d7cb0382187bded718
[AArch64] Remove redundant `mov 0` instruction for high 64-bits

If MI sets zero for high 64-bits implicitly, remove `mov 0` for high 64-bits.
For example,

 %1:fpr64 = nofpexcept FCVTNv4i16 %0:fpr128, implicit $fpcr
 %2:fpr64 = MOVID 0
 %4:fpr128 = IMPLICIT_DEF
 %3:fpr128 = INSERT_SUBREG %4:fpr128(tied-def 0), killed %2:fpr64, %subreg.dsub
 %6:fpr128 = IMPLICIT_DEF
 %5:fpr128 = INSERT_SUBREG %6:fpr128(tied-def 0), killed %1:fpr64, %subreg.dsub
 %7:fpr128 = INSvi64lane %5:fpr128(tied-def 0), 1, killed %3:fpr128, 0
 ==>
 %1:fpr64 = nofpexcept FCVTNv4i16 %0:fpr128, implicit $fpcr
 %6:fpr128 = IMPLICIT_DEF
 %7:fpr128 = INSERT_SUBREG %6:fpr128(tied-def 0), killed %1:fpr64, %subreg.dsub

Differential Revision: https://reviews.llvm.org/D147235
llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
llvm/test/CodeGen/AArch64/aarch64-neon-vector-insert-uaddlv.ll
llvm/test/CodeGen/AArch64/implicitly-set-zero-high-64-bits.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/peephole-insvigpr.mir