[AArch64] Remove ToBeRemoved from AArch64MIPeepholeOpt
authorDavid Green <david.green@arm.com>
Wed, 8 Jun 2022 16:26:07 +0000 (17:26 +0100)
committerDavid Green <david.green@arm.com>
Wed, 8 Jun 2022 16:26:07 +0000 (17:26 +0100)
commita1aef4f3747063a1a111cc84338c06dba42d2edf
tree8d7518bcc1e69d49164e8b9ef4d21b58f2ebe1a0
parent122da690b39a67cd6e6bce4b9ad3ac1470cc1ed5
[AArch64] Remove ToBeRemoved from AArch64MIPeepholeOpt

The ToBeRemoved is used to remove any MachineInstructions that are no
longer needed, making sure we don't invalidate the iterator that is
currently in use by erasing the instruction straight away. This makes
issues for keeping the code in SSA from though, where subsequent
transforms that require SSA form may have been broken by previous
peepholes.

If, instead, we use make_early_inc_range the iteration issue shouldn't
be present, so long as we do not remove the subsequent instruction in
the peephole optimizations. That way the code between transforms is kept
in SSA form, meaning hopefully less things that can go wrong.

Differential Revision: https://reviews.llvm.org/D127296
llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
llvm/test/CodeGen/AArch64/peephole-orr.mir [new file with mode: 0644]