This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/55629] Missed value numbering to a constant
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Dec 2012 08:50:12 +0000
- Subject: [Bug tree-optimization/55629] Missed value numbering to a constant
- Auto-submitted: auto-generated
- References: <bug-55629-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55629
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-10 08:50:12 UTC ---
I know that there is a duplicate of this bug, at least for a simpler
testcase ... but I can't find it right now.
The issue is that SCCVN does not do PHI-translation, that is,
<bb 2>:
if (c_3(D) != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
a_4 = 3;
b_5 = 2;
goto <bb 5>;
<bb 4>:
a_6 = 2;
b_7 = 3;
<bb 5>:
# a_1 = PHI <3(3), 2(4)>
# b_2 = PHI <2(3), 3(4)>
_8 = a_1 + b_2;
SCCVN would need to lookup a_1 and b_2 on both incoming edges when it tries
to simplify a_1 + b_2, match up the results and if equal register the
simplification.
I'm not sure that handling this case (which would certainly be possible)
is worth the cost it has on all expressions that do _not_ simplify that way.
(of course we can see whether the value-numbers for a_1/b_2 do have
has_constants set).
Time for a value-number missed-optimization meta bug, there are quite some
special cases that we do not handle.