[llvm] [MachineSink] Clear kill flags of sunk addressing mode registers (PR #75072)

Momchil Velikov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 14:02:40 PST 2023


================
@@ -530,6 +525,14 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI,
     } else {
----------------
momchil-velikov wrote:

No, the copies are ok. We have a chain/tree of copies:
```
r1 = copy r0
...
rn = copy rn-1
x = op a, b, rn
```
and then we create `x = op a, b, r0` and all the copies, including the first one are deleted in this function, so it doesn't matter what flags are left in the short time between creation of the new instruction and the deletion of the old one.

The case for zext on AArch64 is a little bit different in that we don't delete the `ORRWrs` , we delete only the `SUBREG_TO_REG`, but at the same time we use an operand from `ORRWrs`.

In principle, we could try to delete dead instructions going up to the beginning of the block, but the correctness check is
a bit more complex and we run the DeadMachineInstrucitonElim pass shortly after anyway.


https://github.com/llvm/llvm-project/pull/75072


More information about the llvm-commits mailing list