Testcase:
int f(int t)
{
int i;
if(t)
for(i = 0 ;i<100000;i++)
;
else
return 2;
return 1;
}
----
in the tree dump:
<bb 0>:
if (t_3 != 0) goto <L1>; else goto <L6>;
Invalid sum of incoming frequencies 1100, should be 10000
# i_6 = PHI <0(0)>;
<L1>:;
i_8 = i_6 + 1;
Invalid sum of incoming frequencies 10542, should be 1642
# D.1276_2 = PHI <2(0), 1(1)>;
<L6>:;
return D.1276_2;
--- in final_cleanup:
<bb 0>:
if (t != 0) goto <L1>; else goto <L14>;
<L14>:;
D.1276 = 2;
goto <bb 3> (<L6>);
Invalid sum of incoming frequencies 1100, should be 10000
<L1>:;
D.1276 = 1;
Invalid sum of incoming frequencies 10542, should be 1642
<L6>:;
return D.1276;
--
Summary: Frequences are not updated for empty loop removal
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23475