[GlobalISel][AArch64] Fix contract cross-bank copies with SIMD instructions
authorShu-Chun Weng <scw@google.com>
Tue, 4 Feb 2020 23:52:57 +0000 (15:52 -0800)
committerShu-Chun Weng <scw@google.com>
Wed, 5 Feb 2020 18:38:35 +0000 (10:38 -0800)
commitce9633633c07045068d202cc225dbf2deb7e4e8b
treed449f4202bfcb41b48d79a561159b66f3e04eed2
parentf64b3466b6bbea0422209ecaceecd361bb09ff87
[GlobalISel][AArch64] Fix contract cross-bank copies with SIMD instructions

contractCrossBankCopyIntoStore() finds the instruction defines the
source register and uses its output to replace the register. There are,
however, instructions that have multiple outputs, e.g. G_UNMERGE_VALUES.
Current implementation hardcodes to operand 0 and has no way of knowing
which output should be used.

This change adds another function to directly return the register that
is the source of the register and use that for folding.

This fixes https://bugs.llvm.org/show_bug.cgi?id=44783

Differential Revision: https://reviews.llvm.org/D74005
llvm/include/llvm/CodeGen/GlobalISel/Utils.h
llvm/lib/CodeGen/GlobalISel/Utils.cpp
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/contract-store.mir