This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Don't allow non-registers to take UNDEFINED values
- From: Diego Novillo <dnovillo at redhat dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 29 Jul 2004 20:20:29 -0400
- Subject: Don't allow non-registers to take UNDEFINED values
- Organization: Red Hat Canada
When visiting an assignment statement in SSA-CCP, we prevent a
non-register from transitioning UNKNOWN_VAL -> UNDEFINED. But we don't
do it always, only when the RHS of the assignment is another SSA_NAME.
This patch just moves the code to prevent this transition further down.
Caught in the fortran testsuite with a patch I'm working on.
Bootstrapped on x86-64.
Diego.
* tree-ssa-ccp.c (visit_assignment): Move code to prevent
setting a non-register to UNDEFINED right before the call to
set_lattice_value.
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-ccp.c,v
retrieving revision 2.27
diff -d -c -p -r2.27 tree-ssa-ccp.c
*** tree-ssa-ccp.c 28 Jul 2004 05:13:08 -0000 2.27
--- tree-ssa-ccp.c 30 Jul 2004 00:13:47 -0000
*************** visit_assignment (tree stmt)
*** 755,766 ****
/* For a simple copy operation, we copy the lattice values. */
value *nval = get_value (rhs);
val = *nval;
-
- /* If lhs is not a gimple register, then it cannot take on
- an undefined value. */
- if (!is_gimple_reg (SSA_NAME_VAR (lhs))
- && val.lattice_val == UNDEFINED)
- val.lattice_val = UNKNOWN_VAL;
}
else if (DECL_P (rhs)
&& NUM_VUSES (vuses) == 1
--- 755,760 ----
*************** visit_assignment (tree stmt)
*** 798,803 ****
--- 792,803 ----
}
}
+ /* If LHS is not a gimple register, then it cannot take on an
+ UNDEFINED value. */
+ if (!is_gimple_reg (SSA_NAME_VAR (lhs))
+ && val.lattice_val == UNDEFINED)
+ val.lattice_val = UNKNOWN_VAL;
+
/* Set the lattice value of the statement's output. */
set_lattice_value (lhs, val);
if (val.lattice_val == VARYING)