3 Commits

Author SHA1 Message Date
Craig Topper
6732896bbf [RISCV] Use analyzeBranch in RISCVRedundantCopyElimination.
The existing code was incorrect if we had more than one conditional
branch instruction in a basic block. Though I don't think that will
occur, using analyzeBranch detects that as an unsupported case.

Overall this results in simpler code in RISCVRedundantCopyElimination.

Reviewed By: reames, kito-cheng

Differential Revision: https://reviews.llvm.org/D132347
2022-08-29 09:05:53 -07:00
Craig Topper
abce7acebd [RISCV] Remove impossible TODO in RISCVRedundantCopyElimination. NFC
If there are multiple conditional branches we shouldn't do any
optimization.
2022-08-21 13:18:02 -07:00
Craig Topper
1d8bbe3d25 [RISCV] Implement a basic version of AArch64RedundantCopyElimination pass.
Using AArch64's original implementation for reference, this patch
implements a pass to remove unneeded copies of X0. This pass runs
after register allocation and looks to see if a register is implied
to be 0 by a branch in the predecessor basic block.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D118160
2022-02-04 10:43:46 -08:00