From 5753a5c19392e1b9a752761488c6d3e98c6e32a0 Mon Sep 17 00:00:00 2001 From: Anthony Pesch Date: Mon, 14 Aug 2017 17:48:49 -0400 Subject: [PATCH] remove old extended basic block related optimizations --- src/jit/passes/control_flow_analysis_pass.c | 14 ++++---------- src/jit/passes/load_store_elimination_pass.c | 16 ++++------------ 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/jit/passes/control_flow_analysis_pass.c b/src/jit/passes/control_flow_analysis_pass.c index 288e863f..f852c291 100644 --- a/src/jit/passes/control_flow_analysis_pass.c +++ b/src/jit/passes/control_flow_analysis_pass.c @@ -6,18 +6,12 @@ void cfa_run(struct cfa *cfa, struct ir *ir) { list_for_each_entry(block, &ir->blocks, struct ir_block, it) { list_for_each_entry(instr, &block->instrs, struct ir_instr, it) { /* add edges between blocks for easy traversing */ - if (instr->op == OP_BRANCH) { - if (instr->arg[0]->type == VALUE_BLOCK) { + if (instr->op == OP_BRANCH || instr->op == OP_BRANCH_FALSE || + instr->op == OP_BRANCH_TRUE) { + if (instr->arg[0]->blk) { ir_add_edge(ir, block, instr->arg[0]->blk); } - } /* else if (instr->op == OP_BRANCH_COND) { - if (instr->arg[1]->type == VALUE_BLOCK) { - ir_add_edge(ir, block, instr->arg[1]->blk); - } - if (instr->arg[2]->type == VALUE_BLOCK) { - ir_add_edge(ir, block, instr->arg[2]->blk); - } - }*/ + } } } } diff --git a/src/jit/passes/load_store_elimination_pass.c b/src/jit/passes/load_store_elimination_pass.c index 6734d28b..37d1f518 100644 --- a/src/jit/passes/load_store_elimination_pass.c +++ b/src/jit/passes/load_store_elimination_pass.c @@ -102,13 +102,9 @@ static void lse_eliminate_loads(struct lse *lse, struct ir *ir, if (instr->op == OP_FALLBACK || instr->op == OP_CALL) { lse_clear_available(lse); } else if (instr->op == OP_BRANCH) { - if (instr->arg[0]->type != VALUE_BLOCK) { - lse_clear_available(lse); - } + lse_clear_available(lse); } else if (instr->op == OP_BRANCH_TRUE || instr->op == OP_BRANCH_FALSE) { - if (instr->arg[1]->type != VALUE_BLOCK) { - lse_clear_available(lse); - } + lse_clear_available(lse); } else if (instr->op == OP_LOAD_CONTEXT) { /* if there is already a value available for this offset, reuse it and remove this redundant load */; @@ -142,13 +138,9 @@ static void lse_eliminate_stores(struct lse *lse, struct ir *ir, if (instr->op == OP_FALLBACK || instr->op == OP_CALL) { lse_clear_available(lse); } else if (instr->op == OP_BRANCH) { - if (instr->arg[0]->type != VALUE_BLOCK) { - lse_clear_available(lse); - } + lse_clear_available(lse); } else if (instr->op == OP_BRANCH_TRUE || instr->op == OP_BRANCH_FALSE) { - if (instr->arg[1]->type != VALUE_BLOCK) { - lse_clear_available(lse); - } + lse_clear_available(lse); } else if (instr->op == OP_LOAD_CONTEXT) { int offset = instr->arg[0]->i32; int size = ir_type_size(instr->result->type);