This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Verifier for sub-variables vs mem-ssa
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>, gcc at gcc dot gnu dot org
- Date: Thu, 21 Sep 2006 12:59:00 -0400
- Subject: Verifier for sub-variables vs mem-ssa
With some local changes I've done in the mem-ssa branch I'm getting a verification
error in execute/20050206-1.c:
foo ()
{
short unsigned int u[1];
# SFT.0_9 = VDEF <.MEM_8(D)>
u[0] = 1;
# SFT.0_10 = VDEF <SFT.0_9>
u[0] = 0;
# u_11 = VDEF <.MEM_8(D)>
u[1] = 1;
# u_12 = VDEF <u_11>
u[2] = 2;
[ ... ]
}
The problem here is that since 'u' is an array of one element, we only ever
create an SFT for u[0], which is reasonable:
Variable: u, UID 1523, short unsigned int[1], sub-vars: { SFT.0 }
The problem starts when the operand scanner in mem-ssa determines that since neither
u[1] nor u[2] have corresponding SFTs, they get to use 'u' directly. This is different
from mainline. In mainline we use SFT.0 for all of them:
foo ()
{
short unsigned int u[1];
# SFT.0_2 = V_MUST_DEF <SFT.0_1>;
u[0] = 1;
# SFT.0_3 = V_MUST_DEF <SFT.0_2>;
u[0] = 0;
# SFT.0_4 = V_MAY_DEF <SFT.0_3>;
u[1] = 1;
# SFT.0_5 = V_MAY_DEF <SFT.0_4>;
u[2] = 2;
[ ... ]
}
Which does not trigger the validation error, but I believe it's less precise
than what is computed in mem-ssa. Certainly u[1] and u[2] cannot affect u[0].
Nor can they affect each other, but this is undefined code, so it's not such a
big deal.
The verifier is being tricked because it uses a fairly simple test:
if (is_virtual && var_ann (SSA_NAME_VAR (ssa_name))
&& get_subvars_for_var (SSA_NAME_VAR (ssa_name)) != NULL)
{
error ("found real variable when subvariables should have appeared");
....
I'm meaning to change the verifier to check if the statement is really
referencing a sub-variable, but first I wanted to check if the idea
makes sense.
Thanks.