From 4b79b78b8c3b9cd6deed46e6aa38acabfc47d25b Mon Sep 17 00:00:00 2001 From: Ficture Seven Date: Mon, 11 May 2020 04:04:52 +0400 Subject: [PATCH] Fix tailcall case in EmitterContext (#1235) --- ARMeilleure/Translation/EmitterContext.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ARMeilleure/Translation/EmitterContext.cs b/ARMeilleure/Translation/EmitterContext.cs index 7abda1a7..2195830c 100644 --- a/ARMeilleure/Translation/EmitterContext.cs +++ b/ARMeilleure/Translation/EmitterContext.cs @@ -609,15 +609,10 @@ namespace ARMeilleure.Translation private static bool EndsWithUnconditional(BasicBlock block) { - Operation lastOp = block.GetLastOp() as Operation; - - if (lastOp == null) - { - return false; - } - - return lastOp.Instruction == Instruction.Branch || - lastOp.Instruction == Instruction.Return; + return block.Operations.Last is Operation lastOp && + (lastOp.Instruction == Instruction.Branch || + lastOp.Instruction == Instruction.Return || + lastOp.Instruction == Instruction.Tailcall); } public ControlFlowGraph GetControlFlowGraph()