[GlobalISel] Fix equality for copies from physregs in matchEqualDefs
authorJessica Paquette <jpaquette@apple.com>
Thu, 26 Mar 2020 22:00:34 +0000 (15:00 -0700)
committerJessica Paquette <jpaquette@apple.com>
Sat, 28 Mar 2020 00:52:21 +0000 (17:52 -0700)
commit98d05f88d55b8b2e5a1392110030d5f45ad4cbcf
treeb46d48cbcf8446c13b0b05b5ebce7c02dc2dcf64
parent823dbb4c748feaae6f20637efd0de159dd156c69
[GlobalISel] Fix equality for copies from physregs in matchEqualDefs

When we see this:

```
%a = COPY $physreg
...
SOMETHING implicit-def $physreg
...
%b = COPY $physreg
```

The two copies are not equivalent, and so we shouldn't perform any folding
on them.

When we have two instructions which use a physical register check that they
define the same virtual register(s) as well.

e.g., if we run into this case

```
%a = COPY $physreg
...
%b = COPY %a
```

we can say that the two copies are the same, and can be folded.

Differential Revision: https://reviews.llvm.org/D76890
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-select.mir