aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFICTURE7 <FICTURE7@gmail.com>2021-08-20 21:42:00 +0400
committerGitHub <noreply@github.com>2021-08-20 14:42:00 -0300
commitf2a7b300c471ee7ad9a925f1085ad86537f68154 (patch)
tree5bd8017fb45d18cbbe67ac8e388560a4cc5e7052
parent22b2cb39af00fb8881e908fd671fbf57a6e2db2a (diff)
Fix type mismatch in `BitwiseAnd` simplification (#2571)
* Fix type mismatch in `BitwiseAnd` simplification `TryEliminateBitwiseAnd` would turn the `BitwiseAnd` operation into a copy of the wrong type. E.g: Before `Simplification`: ```llvm i64 %0 = BitwiseAnd i64 0x0, %1 ``` After `Simplication`: ```llvm i64 %0 = Copy i32 0x0 ``` Since the with the changes in #2515, we iterate in reverse order and `Simplication`, `ConstantFolding` does not indicate if it modified the CFG, the second pass to "retype" the copy into the proper destination type does not happen. This also blocked copy propagation since its destination type did not match with its source type. But in the cases I've seen, the `PreAllocator` would insert a copy for the propagated constant, which results in no diffs. Since the copy remained as is, asserts are fired when generating it. * Set PPTC version
-rw-r--r--ARMeilleure/CodeGen/Optimizations/Simplification.cs2
-rw-r--r--ARMeilleure/Translation/PTC/Ptc.cs2
2 files changed, 2 insertions, 2 deletions
diff --git a/ARMeilleure/CodeGen/Optimizations/Simplification.cs b/ARMeilleure/CodeGen/Optimizations/Simplification.cs
index 341143d8..a439d642 100644
--- a/ARMeilleure/CodeGen/Optimizations/Simplification.cs
+++ b/ARMeilleure/CodeGen/Optimizations/Simplification.cs
@@ -71,7 +71,7 @@ namespace ARMeilleure.CodeGen.Optimizations
}
else if (IsConstEqual(x, 0) || IsConstEqual(y, 0))
{
- operation.TurnIntoCopy(Const(0));
+ operation.TurnIntoCopy(Const(x.Type, 0));
}
}
diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs
index 1ed54945..8d4f971b 100644
--- a/ARMeilleure/Translation/PTC/Ptc.cs
+++ b/ARMeilleure/Translation/PTC/Ptc.cs
@@ -27,7 +27,7 @@ namespace ARMeilleure.Translation.PTC
private const string OuterHeaderMagicString = "PTCohd\0\0";
private const string InnerHeaderMagicString = "PTCihd\0\0";
- private const uint InternalVersion = 2515; //! To be incremented manually for each change to the ARMeilleure project.
+ private const uint InternalVersion = 2571; //! To be incremented manually for each change to the ARMeilleure project.
private const string ActualDir = "0";
private const string BackupDir = "1";