From 809c103fd1f6b856b8a788adacdddbbedf10c677 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 8 Mar 2020 03:46:52 +0900 Subject: [PATCH] [qfcc] Shuffle some code around to be clearer Doing the same thing at the end of two branches of an if/else seems off. And doing an associative(?) set operation every time through a loop is wasteful. --- tools/qfcc/source/flow.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/qfcc/source/flow.c b/tools/qfcc/source/flow.c index 526aadbcd..d5288616a 100644 --- a/tools/qfcc/source/flow.c +++ b/tools/qfcc/source/flow.c @@ -458,12 +458,11 @@ flow_kill_aliases (set_t *kill, flowvar_t *var, const set_t *uninit) if (op->op_type == op_temp) { tempop_visit_all (&op->o.tempop, 1, flow_tempop_kill_aliases_visit, tmp); - set_difference (tmp, uninit); } else if (op->op_type == op_def) { def_visit_all (op->o.def, 1, flow_def_kill_aliases_visit, tmp); - // don't allow aliases to kill definitions in the entry dummy block - set_difference (tmp, uninit); } + // don't allow aliases to kill definitions in the entry dummy block + set_difference (tmp, uninit); // merge the alias kills with the current def's kills set_union (kill, tmp); } @@ -492,8 +491,8 @@ flow_reaching_defs (flowgraph_t *graph) for (i = 0; i < graph->func->num_vars; i++) { var = graph->func->vars[i]; set_union (uninit, var->define);// do not want alias handling here - set_difference (uninit, kill); // remove any gens from the function } + set_difference (uninit, kill); // remove any gens from the function graph->nodes[graph->num_nodes]->reaching_defs.out = uninit; graph->nodes[graph->num_nodes]->reaching_defs.in = set_new (); graph->nodes[graph->num_nodes]->reaching_defs.gen = set_new ();