This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Example in tree-dfa for computing alias sets doesn'tmatch actual results
- From: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 02 Oct 2003 13:44:58 +0200
- Subject: [tree-ssa] Example in tree-dfa for computing alias sets doesn'tmatch actual results
Hi,
In the comments in tree-dfa.c, "Compute alias sets", the example
function,
foo (int i)
{
int *p, a, b;
if (i > 10)
p = &a;
else
p = &b;
*p = 3;
a = b + 2;
return *p;
}
is claimed to be renamed to give:
foo (int i)
{
int *p, a, b;
if (i_2 > 10)
p_4 = &a;
else
p_6 = &b;
# p_1 = PHI <p_4(1), p_6(2)>;
# a_7 = VDEF <a_3>;
# b_8 = VDEF <b_5>;
*p_1 = 3;
a_9 = b_8 + 2;
# VUSE <a_9>;
# VUSE <b_8>;
return *p_1;
}
In reality, it looks more like a and b are being treated as if they are
global vars:
;; Function foo (foo)
foo (i)
{
int b.1;
int * p;
int a;
int b;
if (i_2 > 10)
{
p_3 = &a
}
else
{
p_4 = &b
};
# p_1 = PHI <p_3(1), p_4(2)>;
# a_6 = VDEF <a_5>;
# b_8 = VDEF <b_7>;
*p_1 = 3;
# VUSE <b_8>;
b.1_9 = b;
# a_10 = VDEF <a_6>;
a = b.1_9 + 2;
# VUSE <a_10>;
# VUSE <b_8>;
return *p_1;;
}
In fact, if a and b are declared as globals in the example, i.e.,
int a,b;
foo (int i)
{
int *p;
(etc.)
the diff of the ssa1 dumps only is,
- int a;
- int b;
Is this an intended change in behavior? If so, can someone with better
understanding of virtual ops update the comments in tree-dfa.c?
Gr.
Steven