From cf77f2ae5d99896b49c8abc1bbdea7f707c1ff55 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 19 May 2024 18:05:43 -0400 Subject: [PATCH] RedundantFlagCalculationElimination: fix convergence issue If both the destination and the flags are dead for an AddWithFlags, we need to eliminate it in one pass. If we only replace without elimiating, we would need a second DCE pass to eliminate. We want DCE to finish in one pass, so fix this. Signed-off-by: Alyssa Rosenzweig --- .../Interface/IR/Passes/RedundantFlagCalculationElimination.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp b/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp index 69d43d4f7..0089adf17 100644 --- a/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp +++ b/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp @@ -362,7 +362,7 @@ void DeadFlagCalculationEliminination::Run(IREmitter* IREmit) { bool Eliminated = false; if ((FlagsRead & Info.Write) == 0) { - if (Info.CanEliminate && CodeNode->GetUses() == 0) { + if ((Info.CanEliminate || Info.CanReplace) && CodeNode->GetUses() == 0) { IREmit->Remove(CodeNode); Eliminated = true; } else if (Info.CanReplace) {