This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/33434] [4.3 Regression] -fipa-cp miscompilation
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Oct 2007 13:38:14 -0000
- Subject: [Bug tree-optimization/33434] [4.3 Regression] -fipa-cp miscompilation
- References: <bug-33434-7958@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from jakub at gcc dot gnu dot org 2007-10-12 13:38 -------
Doesn't seem to look like a problem in ipa-cp to me, more like an inlining bug.
ipa-cp creates:
T.1 (a, b)
{
_Bool D.1565;
<bb 2>:
if (1)
goto <bb 3>;
else
goto <bb 6>;
<bb 3>:
# b_3 = PHI <1(2)>
goto <bb 5>;
<bb 4>:
k ={v} 1;
<bb 5>:
# b_2 = PHI <b_3(3), b_1(4)>
b_1 = b_2 + -1;
if (b_2 != 0)
goto <bb 4>;
else
goto <bb 8>;
<bb 6>:
if (0)
goto <bb 7>;
else
goto <bb 8>;
<bb 7>:
__builtin_abort ();
<bb 8>:
return;
}
and even the first dump during apply_inline looks correct, inside of main we
have:
...
# BLOCK 4 freq:4999
# b_6 = PHI <1(3)>
goto <bb 6>;
# BLOCK 5 freq:10000
k ={v} 1;
# BLOCK 6 freq:10000
# b_5 = PHI <b_6(4), b_4(5)>
b_4 = b_5 + -1;
if (b_5 != 0)
goto <bb 5>;
else
goto <bb 9>;
But during inlining both a and b are mark_sym_for_renaming and when update_ssa
is called, rewrite_update_stmt -> maybe_replace_use changes that
if (b_5 != 0)
into incorrect:
if (b_4 != 0)
so k is never set to 1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33434