aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineCopyPropagation.cpp
diff options
context:
space:
mode:
authorPiyou Chen <piyou.chen@sifive.com>2024-08-28 08:32:54 +0800
committerGitHub <noreply@github.com>2024-08-28 08:32:54 +0800
commit2def1c445826be77a11926b89f901c0cd6d571d7 (patch)
treee43a2fc3ddeacb5d4d225c209b961193e09f402c /llvm/lib/CodeGen/MachineCopyPropagation.cpp
parent32abe5d49b758edef0f0c19090361a6fe85c4092 (diff)
downloadllvm-2def1c445826be77a11926b89f901c0cd6d571d7.zip
llvm-2def1c445826be77a11926b89f901c0cd6d571d7.tar.gz
llvm-2def1c445826be77a11926b89f901c0cd6d571d7.tar.bz2
[RISCV][MCP] Remove redundant move from tail duplication (#89865)
Tail duplication will generate the redundant move before return. It is because the MachineCopyPropogation can't recognize COPY after post-RA pseudoExpand. This patch make MachineCopyPropogation recognize `%0 = ADDI %1, 0` as COPY
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCopyPropagation.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index b34e093..fab36f4 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -1053,7 +1053,7 @@ void MachineCopyPropagation::BackwardCopyPropagateBlock(
// Ignore non-trivial COPYs.
std::optional<DestSourcePair> CopyOperands =
isCopyInstr(MI, *TII, UseCopyInstr);
- if (CopyOperands && MI.getNumOperands() == 2) {
+ if (CopyOperands) {
Register DefReg = CopyOperands->Destination->getReg();
Register SrcReg = CopyOperands->Source->getReg();