This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: tree-ssa/lno compute_may_aliases failure
- From: Dorit Naishlos <DORIT at il dot ibm dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Diego Novillo <dnovillo at redhat dot com>
- Date: Thu, 20 May 2004 00:29:43 +0300
- Subject: Re: tree-ssa/lno compute_may_aliases failure
I have some more details on the compute_may_aliases problem.
The problem comes up when I'm scheduling an additional compute_may_aliases
pass.
I need it after the vectorizer, but just for the sake of debugging I tried
it on mainline as follows:
*** tree-optimize.c 13 May 2004 06:39:48 -0000 2.15
--- tree-optimize.c 19 May 2004 13:57:41 -0000
*************** init_tree_optimization_passes (void)
*** 307,312 ****
--- 307,317 ----
NEXT_PASS (pass_fold_builtins);
NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_pre);
+ #if 1
+ NEXT_PASS (DUP_PASS (pass_build_pta));
+ NEXT_PASS (DUP_PASS (pass_may_alias));
+ NEXT_PASS (DUP_PASS (pass_del_pta));
+ #endif
NEXT_PASS (DUP_PASS (pass_dominator));
NEXT_PASS (DUP_PASS (pass_redundant_phi));
NEXT_PASS (pass_cd_dce);
Compilation failed on the testcase below:
float *gl_copy_map_points1f( int uorder,
const float *points, unsigned int size)
{
float *buffer, *p;
unsigned int i;
buffer = (float *) malloc(uorder * size * sizeof(float));
if (buffer)
for (i=0, p=buffer; i<uorder; i++)
*p++ = points[i];
return buffer;
}
The error occured in verify_ssa, right after the new invocation of
compute_may_alias,
due to a redundant virtual phi.
Before alias2, 'p' and 'points' are treated as if they alias (both have tag
TMT.9):
# BLOCK 2
# PRED: 8 [100.0%] (fallthru) 5 [100.0%] (fallthru)
# TMT.9<D1145>_27 = PHI <TMT.9<D1145>_23(5), TMT.9<D1145>_25(8)>; <<<
# p<D1107>_2 = PHI <buffer<D1106>_9(5), p<D1107>_28(8)>;
# i<D1108>_1 = PHI <0(5), i<D1108>_29(8)>;
<L1>:;
T.4<D1117>_14 = i<D1108>_1 * 4;
T.5<D1118>_15 = (const float<D23> *)T.4<D1117>_14;
T.6<D1119>_17 = T.5<D1118>_15 + points<D1102>_16;
# VUSE <TMT.9<D1145>_27>; <<< points[i]
T.7<D1120>_18 = *T.6<D1119>_17;
# TMT.9<D1145>_25 = VDEF <TMT.9<D1145>_27>; <<< *p
*p<D1107>_2 = T.7<D1120>_18;
p<D1107>_28 = p<D1107>_2 + 4B;
i<D1108>_29 = i<D1108>_1 + 1;
if (uorder.0<D1110>_4 > i<D1108>_29) goto <L12>; else goto <L11>;
# SUCC: 7 [11.0%] (false,exec) 8 [89.0%] (dfs_back,true,exec)
After alias2, 'p' is known to point to malloc space, and 'points' to an
arbitrary address. The store into *p no longer defines TMT.9, but the phi
remains, with nothing that defines it in the loop:
# BLOCK 2
# PRED: 8 [100.0%] (fallthru) 5 [100.0%] (fallthru)
# NMT.10<D1154>_30 = PHI <NMT.10<D1154>_31(5), NMT.10<D1154>_32(8)>;
# TMT.9<D1145>_27 = PHI <TMT.9<D1145>_23(5), TMT.9<D1145>_25(8)>; <<<
# p<D1107>_2 = PHI <buffer<D1106>_9(5), p<D1107>_28(8)>;
# i<D1108>_1 = PHI <0(5), i<D1108>_29(8)>;
<L1>:;
T.4<D1117>_14 = i<D1108>_1 * 4;
T.5<D1118>_15 = (const float<D23> *)T.4<D1117>_14;
T.6<D1119>_17 = T.5<D1118>_15 + points<D1102>_16;
# VUSE <TMT.9<D1145>_27>; <<<
T.7<D1120>_18 = *T.6<D1119>_17;
# NMT.10<D1154>_32 = VDEF <NMT.10<D1154>_30>; <<<
*p<D1107>_2 = T.7<D1120>_18;
p<D1107>_28 = p<D1107>_2 + 4B;
i<D1108>_29 = i<D1108>_1 + 1;
if (uorder.0<D1110>_4 > i<D1108>_29) goto <L12>; else goto <L11>;
# SUCC: 7 [11.0%] (false,exec) 8 [89.0%] (dfs_back,true,exec)
# BLOCK 8
# PRED: 2 [89.0%] (dfs_back,true,exec)
<L12>:;
goto <bb 2> (<L1>);
# SUCC: 2 [100.0%] (fallthru)
(Actually, in this particular case, this phi was introduced by pass_ch
(copy headers). If I use the flag -fno-tree-ch, then compilation
passes...).
The error:
"
aaa.c: In function `gl_copy_map_points1f':
aaa.c:4: error: Missing definition
for SSA_NAME: TMT.9<D1145>_25
in statement:
TMT.9<D1145>_27 = PHI <TMT.9<D1145>_25(2), TMT.9<D1145>_23(1)>;
PHI argument
TMT.9<D1145>_25
PHI argument
TMT.9<D1145>_23
for PHI node
TMT.9<D1145>_27 = PHI <TMT.9<D1145>_25(2), TMT.9<D1145>_23(1)>;
aaa.c:4: internal compiler error: verify_ssa failed.
"
Any suggestions on how to proceed?
Should there be an inherent problem to apply compute_may_alias where I did
/ the way I did? Or is it a bug in compute_may_alias?
thanks
dorit
Dorit
Naishlos/Haifa/IB To: gcc@gcc.gnu.org
M@IBMIL cc: Diego Novillo <dnovillo@redhat.com>
Sent by: Subject: tree-ssa/lno compute_may_aliases failure
gcc-owner@gcc.gnu
.org
09/05/2004 23:36
I added an invocation of compute_may_aliases pass (I need it after the
vectorizer, as suggested in http://gcc.gnu.org/ml/gcc/2004-02/msg01292.html
), and got a compilation failure during ssa_verify which directly follows
this new invocation of compute_may_aliases. Here is where I added the new
invocation (tree-optimize.c):
NEXT_PASS (pass_dse);
NEXT_PASS (DUP_PASS (pass_forwprop));
NEXT_PASS (DUP_PASS (pass_phiopt));
NEXT_PASS (pass_ccp);
NEXT_PASS (DUP_PASS (pass_redundant_phi));
NEXT_PASS (pass_fold_builtins);
NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_pre);
NEXT_PASS (pass_scev);
+ NEXT_PASS (DUP_PASS (pass_build_pta));
+ NEXT_PASS (DUP_PASS (pass_may_alias));
+ NEXT_PASS (DUP_PASS (pass_del_pta));
NEXT_PASS (pass_loop);
Is there a known reason why compute_may_aliases shouldn't be applied where
I applied it? should I have called an additional pass before it?
The compilation failure occurred in 6 SPEC benchmarks. Here is a small
test-case which triggers the problem (from SPEC's mesa):
float *gl_copy_map_points1f( int target,
int ustride, int uorder,
const float *points, unsigned int size)
{
float *buffer, *p;
unsigned int i, k;
buffer = (float *) malloc(uorder * size * sizeof(float));
if (buffer)
for(i=0, p=buffer; i<uorder; i++, points+=ustride)
for(k=0; k<size; k++)
*p++ = points[k];
return buffer;
}
This is the error I get (compiling the file above with just -O1):
In function `gl_copy_map_points1f':
eval_snippet.c:4: error: Missing definition
for SSA_NAME: TMT.12<D1116>_43
in statement:
TMT.12<D1116>_4 = PHI <TMT.12<D1116>_38(13), TMT.12<D1116>_43(10)>;
PHI argument
TMT.12<D1116>_43
for PHI node
TMT.12<D1116>_4 = PHI <TMT.12<D1116>_38(13), TMT.12<D1116>_43(10)>;
eval_snippet.c:4: error: Missing definition
for SSA_NAME: TMT.12<D1116>_43
in statement:
TMT.12<D1116>_39 = PHI <TMT.12<D1116>_38(14), TMT.12<D1116>_43(9)>;
PHI argument
TMT.12<D1116>_43
for PHI node
TMT.12<D1116>_39 = PHI <TMT.12<D1116>_38(14), TMT.12<D1116>_43(9)>;
eval_snippet.c:4: internal compiler error: verify_ssa failed.
thanks,
dorit