This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SSA_NAMEs not always released


I am writing a "quick and dirty" DCE pass which is faster the current DCE and
does not do anything with stores/loads. It passes over all the live SSA_NAMEs
by looping over ssa_name. But I am running into places where SSA_NAMEs not
released when they become dead. I have a fix for some of these places, we
call bsi_remove and don't call release_defs (I will submit those later,
I already tested it last night) but there are still other places where the
SSA_NAME becomes not alive but does not get released.
On example is:
int f(void)
{
int i;
int *j = &i;
i = 1;
return *j;
}


With the attached patch, I get the following error:
t1.c: In function 'f':
t1.c:2: error: SSA_NAME_DEF_STMT does not define the correct SSA_NAME
while verifying SSA_NAME i_3 in statement
i_1 = 1;

i_3 no longer exists (can be seen by looking at the tree dumps
and at the BasicBlock at the time of checking) but it has not been released
so it is still in the ssa_name VEC and refers to the "i_1 = 1;" statement.
If we take this after DCE, we still refer to a statement which no longer
exists which we don't collect in the GC.


Could someone look into this and see what they can do? This will improve
memory usage in GCC and also there will be more SSA_NAME reuse which is
good.


Thanks,
Andrew Pinsk




Attachment: extrachecking.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]