All registers that were defined in the basic block were subtracted from the
use set. This is right if the order is "define, use", but it's wrong if the
order is "use, define". Fix this by checking if the register has already
been used/defined.

Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 jit/liveness.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/jit/liveness.c b/jit/liveness.c
index b73d96b..f2edfe7 100644
--- a/jit/liveness.c
+++ b/jit/liveness.c
@@ -147,18 +147,18 @@ static void __analyze_use_def(struct basic_block *bb, 
struct insn *insn)
        struct var_info *var;
 
        for_each_variable(var, bb->b_parent->var_infos) {
+               if (insn_uses(insn, var)) {
+                       /*
+                        * It's in the use set if and only if it has not
+                        * _already_ been defined by insn basic block.
+                        */
+                       if (!test_bit(bb->def_set->bits, var->vreg))
+                               set_bit(bb->use_set->bits, var->vreg);
+               }
+
                if (insn_defs(insn, var))
                        set_bit(bb->def_set->bits, var->vreg);
-
-               if (insn_uses(insn, var))
-                       set_bit(bb->use_set->bits, var->vreg);
        }
-
-       /*
-        * It's in the use set if and only if it has not been defined
-        * by insn basic block.
-        */
-       bitset_sub(bb->def_set, bb->use_set);
 }
 
 static void analyze_use_def(struct compilation_unit *cu)
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to