aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/MachineCopyPropagation.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-28 13:45:07 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-28 13:45:07 +0800
commite72ad2cd524ff38f162a23d69da5f78494d337ae (patch)
tree2e590806b0f610e4392f25f6e8cdff57d2f5a929 /backend/lib/CodeGen/MachineCopyPropagation.cpp
parent3b14bd4d5324b5a280c1ee5567b5526b59e60c5b (diff)
downloadrcc-project-e72ad2cd524ff38f162a23d69da5f78494d337ae.tar.gz
rcc-project-e72ad2cd524ff38f162a23d69da5f78494d337ae.tar.xz
[CodeGen] Centralize machine instruction erasure
Diffstat (limited to 'backend/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r--backend/lib/CodeGen/MachineCopyPropagation.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/backend/lib/CodeGen/MachineCopyPropagation.cpp b/backend/lib/CodeGen/MachineCopyPropagation.cpp
index 9cb64cb..94d83e3 100644
--- a/backend/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/backend/lib/CodeGen/MachineCopyPropagation.cpp
@@ -232,7 +232,7 @@ struct CopyOperands final {
if (*Destination == *Source) {
if (!IsGenericCopy)
return false;
- auto Removed = Block->removeInstruction(Copy);
+ auto Removed = Copy.eraseFromParent();
if (!Removed)
return std::unexpected(Removed.error());
return true;
@@ -285,7 +285,7 @@ struct CopyOperands final {
if (IsGenericCopy &&
Operands.DestinationOperand->registerFlags().has(RegisterOperandFlag::Renamable) &&
!valueUsedAfter(Copy, *Destination, Target)) {
- auto Removed = Block->removeInstruction(Copy);
+ auto Removed = Copy.eraseFromParent();
if (!Removed)
return std::unexpected(Removed.error());
Changed = true;
@@ -326,8 +326,7 @@ MachineCopyPropagationPass::runImplementation(MachineFunction &Function,
Instruction = Next;
continue;
}
- auto Accepted =
- Analyses.requestAction("propagate-copy", Function, Instruction->stableID());
+ auto Accepted = Analyses.requestAction("propagate-copy", Function, Instruction->stableID());
if (!Accepted)
return std::unexpected(Accepted.error());
if (!*Accepted) {