From 1325fef70380f0b71a85472988dcf198cc50deaf Mon Sep 17 00:00:00 2001 From: LC Date: Wed, 15 Jul 2026 07:06:20 -0400 Subject: [PATCH] RFCE: Prefer accessing ops with C instead of CW CW is only intended when the op needs to be writable, but most of these are only reading data. --- .../RedundantFlagCalculationElimination.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp b/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp index 9082b49fc..2883f0d73 100644 --- a/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp +++ b/FEXCore/Source/Interface/IR/Passes/RedundantFlagCalculationElimination.cpp @@ -351,22 +351,22 @@ FlagInfo DeadFlagCalculationEliminination::Classify(IROp_Header* IROp) { switch (IROp->Op) { case OP_NZCVSELECT: case OP_NZCVSELECTINCREMENT: { - auto Op = IROp->CW(); + auto Op = IROp->C(); return FlagInfo::Pack({.Read = FlagsForCondClassType(Op->Cond)}); } case OP_NZCVSELECTV: { - auto Op = IROp->CW(); + auto Op = IROp->C(); return FlagInfo::Pack({.Read = FlagsForCondClassType(Op->Cond)}); } case OP_NEG: { - auto Op = IROp->CW(); + auto Op = IROp->C(); return FlagInfo::Pack({.Read = FlagsForCondClassType(Op->Cond)}); } case OP_CONDJUMP: { - auto Op = IROp->CW(); + auto Op = IROp->C(); if (!Op->FromNZCV) { return FlagInfo::Pack({}); } @@ -376,7 +376,7 @@ FlagInfo DeadFlagCalculationEliminination::Classify(IROp_Header* IROp) { case OP_CONDSUBNZCV: case OP_CONDADDNZCV: { - auto Op = IROp->CW(); + auto Op = IROp->C(); return FlagInfo::Pack({ .Read = FlagsForCondClassType(Op->Cond), .Write = FLAG_NZCV, @@ -385,7 +385,7 @@ FlagInfo DeadFlagCalculationEliminination::Classify(IROp_Header* IROp) { } case OP_RMIFNZCV: { - auto Op = IROp->CW(); + auto Op = IROp->C(); static_assert(FLAG_N == (1 << 3), "rmif mask lines up with our bits"); static_assert(FLAG_Z == (1 << 2), "rmif mask lines up with our bits"); @@ -399,7 +399,7 @@ FlagInfo DeadFlagCalculationEliminination::Classify(IROp_Header* IROp) { } case OP_INVALIDATEFLAGS: { - auto Op = IROp->CW(); + auto Op = IROp->C(); unsigned Flags = 0; // TODO: Make this translation less silly @@ -536,7 +536,7 @@ bool DeadFlagCalculationEliminination::ProcessBlock(IREmitter* IREmit, IRListVie // Initialize the FlagsRead mask according to the exit instruction. auto [ExitNode, ExitOp] = CodeLast(); if (ExitOp->Op == IR::OP_CONDJUMP) { - auto Op = ExitOp->CW(); + auto Op = ExitOp->C(); FlagsRead = CFG.Get(Op->TrueBlock)->Flags | CFG.Get(Op->FalseBlock)->Flags; } else if (ExitOp->Op == IR::OP_JUMP) { FlagsRead = CFG.Get(ExitOp->Args[0])->Flags; @@ -643,7 +643,7 @@ void DeadFlagCalculationEliminination::OptimizeParity(IREmitter* IREmit, IRListV for (auto [CodeNode, IROp] : CurrentIR.GetCode(Block)) { if (IROp->Op == OP_STOREPF) { - auto Op = IROp->CW(); + auto Op = IROp->C(); auto Generator = CurrentIR.GetOp(Op->Value); // Determine if we only write 0/1 to the parity flag. @@ -696,7 +696,7 @@ void DeadFlagCalculationEliminination::Run(IREmitter* IREmit) { --CodeLast; auto [ExitNode, ExitOp] = CodeLast(); if (ExitOp->Op == IR::OP_CONDJUMP) { - auto Op = ExitOp->CW(); + auto Op = ExitOp->C(); CFG.RecordEdge(Block->ID, Op->TrueBlock); CFG.RecordEdge(Block->ID, Op->FalseBlock);