This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[help]failed to generate PHI NODE in esra pass.
- From: Yangyueming <yueming dot yang at huawei dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Sat, 3 Nov 2012 09:01:53 +0000
- Subject: [help]failed to generate PHI NODE in esra pass.
Hi, all
I do the research of min max instructions recently. I find it is related with phiopt.
case1:
int foo(short a ,short b)
{
? if (a < b)
??? a = b; ?
??return a;
}
It is successed in pass phiopt1(-O2 with gcc 4.7.0). The MAX_EXPR can be generated.
foo (short int a, short int b)
{
? int D.2094;
<bb 2>:
? a_9 = MAX_EXPR <a_2(D), b_3(D)>;
? D.2094_5 = (int) a_9;
? return D.2094_5;
}
But when I do the test for a case with a little change, it is failed to generate MAX_EXPR in phiopt1.
The failed case2 :
int foo(short a ,short b)
{
? int c;
? if (a < b)
??? a = b;
??
??c = *(int *)&a;
? return c;
}
I find it is because of the esra pass failed to generate PHI NODE.
Dump of phifail.c.027t.esra:
foo (short int a, short int b)
{
? int c;
? short int a$0;
<bb 2>:
? a$0_1 = a;
? if (a$0_1 < b_2(D))
??? goto <bb 3>;
? else
??? goto <bb 4>;
<bb 3>:
? a = b_2(D);
<bb 4>:
? c_4 = MEM[(int *)&a];
? c_5 = c_4;
? return c_5;
}
Why it is failed and if there's a way to make it work?
Please give some help, thanks.
????????????????????????????????????????????????
?????????????????????????????????????????????????Yang Yueming.