From 15868801148129802173f2162ebff24835cb20ba Mon Sep 17 00:00:00 2001
From: FICTURE7 <FICTURE7@gmail.com>
Date: Sun, 21 Feb 2021 21:33:59 +0400
Subject: [PATCH] Turn Copy into Fill in HybridAllocator (#2010)

* Turn Copy into Fill in HybridAllocator

* Set PTC internal verison
---
 .../CodeGen/RegisterAllocators/HybridAllocator.cs        | 9 +++++++++
 ARMeilleure/Translation/PTC/Ptc.cs                       | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ARMeilleure/CodeGen/RegisterAllocators/HybridAllocator.cs b/ARMeilleure/CodeGen/RegisterAllocators/HybridAllocator.cs
index 898cc1db81..aa10aea07f 100644
--- a/ARMeilleure/CodeGen/RegisterAllocators/HybridAllocator.cs
+++ b/ARMeilleure/CodeGen/RegisterAllocators/HybridAllocator.cs
@@ -236,6 +236,15 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
                                 }
                             }
                         }
+                        else if (node is Operation operation && operation.Instruction == Instruction.Copy)
+                        {
+                            Operation fillOp = Operation(Instruction.Fill, node.Destination, Const(info.SpillOffset));
+
+                            block.Operations.AddBefore(node, fillOp);
+                            block.Operations.Remove(node);
+
+                            node = fillOp;
+                        }
                         else
                         {
                             Operand temp = info.Temp;
diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs
index 40d2ad5c1a..6dd902bc34 100644
--- a/ARMeilleure/Translation/PTC/Ptc.cs
+++ b/ARMeilleure/Translation/PTC/Ptc.cs
@@ -22,7 +22,7 @@ namespace ARMeilleure.Translation.PTC
     {
         private const string HeaderMagic = "PTChd";
 
-        private const int InternalVersion = 2026; //! To be incremented manually for each change to the ARMeilleure project.
+        private const int InternalVersion = 2010; //! To be incremented manually for each change to the ARMeilleure project.
 
         private const string ActualDir = "0";
         private const string BackupDir = "1";