1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-26 13:10:22 +02:00

Correct the reason the simplify_stxi bug was not noticed before

* 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.
This commit is contained in:
Paulo Andrade 2015-02-03 15:42:50 -02:00
parent 5724068b1c
commit f6970c62cf
2 changed files with 17 additions and 3 deletions

View file

@ -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;