From c25399bbbb26d19ffb467b09f9da7f952e22ef54 Mon Sep 17 00:00:00 2001 From: Aleksey Demakov Date: Tue, 4 Aug 2009 00:30:00 +0700 Subject: [PATCH] avoid jump tables while cleaning branches --- ChangeLog | 5 +++++ jit/jit-block.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0724190..7f06913 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-08-04 Aleksey Demakov + + * jit/jit-block.c (_jit_block_clean_cfg): avoid jump tables + while cleaning branches (thanks Fredrik Ehnbom). + 2009-06-10 Aleksey Demakov * jit/jit-rules-x86.ins (JIT_OP_BR_LFALSE): add opcode rule. diff --git a/jit/jit-block.c b/jit/jit-block.c index 43e9a67..82e2791 100644 --- a/jit/jit-block.c +++ b/jit/jit-block.c @@ -604,11 +604,16 @@ _jit_block_clean_cfg(jit_function_t func) } if(block->succs[0]->flags == _JIT_EDGE_BRANCH) { + insn = _jit_block_get_last(block); + if(insn->opcode == JIT_OP_JUMP_TABLE) + { + /* skip jump tables, handle only branches */ + continue; + } if(block->succs[0]->dst == block->next) { /* Replace useless branch with NOP */ changed = 1; - insn = _jit_block_get_last(block); insn->opcode = JIT_OP_NOP; if(block->num_succs == 1) { @@ -633,7 +638,6 @@ _jit_block_clean_cfg(jit_function_t func) remove the fallthough edge while leaving the branch edge */ changed = 1; - insn = _jit_block_get_last(block); insn->opcode = JIT_OP_BR; block->ends_in_dead = 1; delete_edge(func, block->succs[1]); -- 2.47.3