From 26a881176eb6513a98889648e0d5b7fe647cd0e3 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 9 Apr 2022 11:56:50 -0300 Subject: [PATCH] Fix tail merge from block with conditional jump to multiple returns (#3267) * Fix tail merge from block with conditional jump to multiple returns * PPTC version bump --- ARMeilleure/CodeGen/Optimizations/TailMerge.cs | 2 +- ARMeilleure/Signal/NativeSignalHandler.cs | 2 +- ARMeilleure/Translation/PTC/Ptc.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ARMeilleure/CodeGen/Optimizations/TailMerge.cs b/ARMeilleure/CodeGen/Optimizations/TailMerge.cs index f85b9c69ab..e94df159cc 100644 --- a/ARMeilleure/CodeGen/Optimizations/TailMerge.cs +++ b/ARMeilleure/CodeGen/Optimizations/TailMerge.cs @@ -59,7 +59,7 @@ namespace ARMeilleure.CodeGen.Optimizations BasicBlock fromPred = from.Predecessors.Count == 1 ? from.Predecessors[0] : null; // If the block is empty, we can try to append to the predecessor and avoid unnecessary jumps. - if (from.Operations.Count == 0 && fromPred != null) + if (from.Operations.Count == 0 && fromPred != null && fromPred.SuccessorsCount == 1) { for (int i = 0; i < fromPred.SuccessorsCount; i++) { diff --git a/ARMeilleure/Signal/NativeSignalHandler.cs b/ARMeilleure/Signal/NativeSignalHandler.cs index 9f14dd6b44..8cb2ee9878 100644 --- a/ARMeilleure/Signal/NativeSignalHandler.cs +++ b/ARMeilleure/Signal/NativeSignalHandler.cs @@ -191,7 +191,7 @@ namespace ARMeilleure.Signal // Is the fault address within this tracked region? Operand inRange = context.BitwiseAnd( context.ICompare(faultAddress, rangeAddress, Comparison.GreaterOrEqualUI), - context.ICompare(faultAddress, rangeEndAddress, Comparison.Less) + context.ICompare(faultAddress, rangeEndAddress, Comparison.LessUI) ); // Only call tracking if in range. diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs index 35bbc56e09..43f3b08bdb 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 = 3193; //! To be incremented manually for each change to the ARMeilleure project. + private const uint InternalVersion = 3267; //! To be incremented manually for each change to the ARMeilleure project. private const string ActualDir = "0"; private const string BackupDir = "1";