diff --git a/ChangeLog b/ChangeLog index 0f6530d85..0a6fa04ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2015-02-03 Paulo Andrade + + * lib/lightning.c: Correct the reason the bug in + simplify_stxi was not triggered before, it was due to + incorrectly resetting the value->code field, what was + causing it to never properly optimize: + stxi Im0 Rb0 Rt0 + ldxi Rt1 Rb1 Im1 + when Rb0 == Rb1, Rt0 == Rt1 and Im0 == Im1 + There was another possible issue, that has been also + addressed in this commit, that would be the case of + Rbn == Rtn, where no redundancy removal is possible. + 2015-02-03 Paulo Andrade * lib/lightning.c: Correct wrong check in simplify_stxi. diff --git a/lib/lightning.c b/lib/lightning.c index d22a95c7f..aab80f80b 100644 --- a/lib/lightning.c +++ b/lib/lightning.c @@ -2759,7 +2759,8 @@ _simplify_ldxi(jit_state_t *_jit, jit_node_t *prev, jit_node_t *node) regno = jit_regno(node->u.w); right = jit_regno(node->v.w); value = _jitc->values + regno; - if (value->kind == jit_kind_code && value->code == node->code && + if (regno != right && + value->kind == jit_kind_code && value->code == node->code && value->base.q.l == right && value->base.q.h == _jitc->gen[right] && node->w.w == value->disp.w) { del_node(prev, node); @@ -2788,7 +2789,8 @@ _simplify_stxi(jit_state_t *_jit, jit_node_t *prev, jit_node_t *node) value = _jitc->values + regno; /* check for redundant store after load */ - if (value->kind == jit_kind_code && value->code == node->code && + if (regno != right && + value->kind == jit_kind_code && value->code == node->code && value->base.q.l == right && value->base.q.h == _jitc->gen[right] && node->u.w == value->disp.w) { del_node(prev, node); @@ -2818,7 +2820,6 @@ _simplify_stxi(jit_state_t *_jit, jit_node_t *prev, jit_node_t *node) default: abort(); } value->kind = jit_kind_code; - value->code = node->code; value->base.q.l = right; value->base.q.h = _jitc->gen[right]; value->disp.w = node->u.w;