This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/54571] Missed optimization converting between bit sets
- 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: Fri, 14 Sep 2012 08:39:42 +0000
- Subject: [Bug middle-end/54571] Missed optimization converting between bit sets
- Auto-submitted: auto-generated
- References: <bug-54571-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54571
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-09-14
Version|unknown |4.8.0
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-14 08:39:42 UTC ---
Confirmed. The natural place to optimize this is the tree level phiopt pass.
<bb 2>:
_3 = x_2(D) & 2;
if (_3 != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
y_5 = y_4(D) | 1;
<bb 4>:
# y_1 = PHI <y_4(D)(2), y_5(3)>
where we should handle
int f1(int x, int y, int d) { int tem; if ((tem = x & d)) y |= tem; return y; }
as well. Yes, that's just y |= x & d, but it falls out naturally if the
transform is implemented in a generic enough way.