[Bug tree-optimization/46693] incorrect code generation with -O2 optimization enabled
ramana at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 13 10:54:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46693
Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Component|target |tree-optimization
--- Comment #9 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2010-12-13 10:53:31 UTC ---
On trunk
vrp converts the IR from :
<bb 3>:
c_5 = D.2034_4;
D.2026_6 = D.2034_4 == 13;
D.2027_7 = D.2034_4 == 10;
D.2028_8 = D.2026_6 || D.2027_7;
if (D.2028_8 != 0)
goto <bb 7>;
else
goto <bb 4>;
<bb 4>:
D.2030_9 = D.2034_4 <= 31;
D.2031_10 = D.2034_4 != 9;
D.2032_11 = D.2030_9 && D.2031_10;
if (D.2032_11 != 0)
goto <bb 7>;
else
goto <bb 5>;
<bb 5>:
str_12 = str_1 + 1;
<bb 6>:
# str_1 = PHI <str_3(D)(2), str_12(5)>
D.2034_4 = *str_1;
if (D.2034_4 != 0)
goto <bb 3>;
else
goto <bb 7>;
<bb 7>:
# D.2033_2 = PHI <0(4), 1(6), 0(3)>
return D.2033_2;
to
<bb 3>:
c_5 = D.2034_4;
D.2026_6 = D.2034_4 == 13;
D.2027_7 = D.2034_4 == 10;
D.2028_8 = D.2026_6 | D.2027_7;
if (D.2028_8 != 0)
goto <bb 7>;
else
goto <bb 4>;
<bb 4>:
D.2030_9 = D.2034_4 <= 31;
D.2031_10 = D.2034_4 != 9;
D.2032_11 = D.2030_9 & D.2031_10;
if (D.2032_11 != 0)
goto <bb 7>;
else
goto <bb 5>;
<bb 5>:
str_12 = str_1 + 1;
<bb 6>:
# str_1 = PHI <str_3(D)(2), str_12(5)>
D.2034_4 = *str_1;
if (D.2034_4 != 0)
goto <bb 3>;
else
goto <bb 7>;
<bb 7>:
# D.2033_2 = PHI <0(4), 1(6), 0(3)>
return D.2033_2;
After a while ifcombine comes along and removes basic block 5 and merges blocks
3 and 4 into 1 basic block because it thinks that the
optimizing two comparisons to 1
Merging blocks 3 and 4
Removing basic block 5
and converts this to this form:
<bb 2>:
goto <bb 4>;
<bb 3>:
D.2026_6 = D.2034_4 == 13;
D.2027_7 = D.2034_4 == 10;
D.2028_8 = D.2026_6 | D.2027_7;
D.2030_9 = D.2034_4 <= 31;
D.2031_10 = D.2034_4 != 9;
D.2032_11 = D.2030_9 & D.2031_10;
goto <bb 5>;
<bb 4>:
Invalid sum of incoming frequencies 873, should be 10000
# str_1 = PHI <str_3(D)(2)>
D.2034_4 = *str_1;
if (D.2034_4 != 0)
goto <bb 3>;
else
goto <bb 5>;
<bb 5>:
Invalid sum of incoming frequencies 10000, should be 873
# D.2033_2 = PHI <0(3), 1(4)>
return D.2033_2;
More information about the Gcc-bugs
mailing list