guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 361/437: Correct the reason the simplify_stxi bug was no


From: Andy Wingo
Subject: [Guile-commits] 361/437: Correct the reason the simplify_stxi bug was not noticed before
Date: Mon, 2 Jul 2018 05:14:55 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit f6970c62cf1be6df44b04890f800fbdd2626d1b3
Author: Paulo Andrade <address@hidden>
Date:   Tue Feb 3 15:42:50 2015 -0200

    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.
---
 ChangeLog       | 13 +++++++++++++
 lib/lightning.c |  7 ++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0f6530d..0a6fa04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2015-02-03 Paulo Andrade <address@hidden>
 
+       * 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 <address@hidden>
+
        * lib/lightning.c: Correct wrong check in simplify_stxi.
        The test was incorrectly comparing the target register
        and the displacement offset. This was a time bomb bug,
diff --git a/lib/lightning.c b/lib/lightning.c
index d22a95c..aab80f8 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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]