This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/32306] [4.6/4.7/4.8 Regression] redundant && || not eliminated
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 Jan 2013 11:26:09 +0000
- Subject: [Bug tree-optimization/32306] [4.6/4.7/4.8 Regression] redundant && || not eliminated
- Auto-submitted: auto-generated
- References: <bug-32306-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32306
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-10 11:26:09 UTC ---
It generally depends on the branch cost, e.g. out of #c19 testcase on x86_64 we
generate:
D.1729 = b1 != 0;
D.1730 = b2 != 0;
D.1731 = D.1729 & D.1730;
if (D.1731 != 0) goto <D.1732>; else goto <D.1727>;
<D.1732>:
D.1733 = b3 != 0;
D.1734 = b4 != 0;
D.1735 = D.1733 & D.1734;
if (D.1735 != 0) goto <D.1736>; else goto <D.1727>;
<D.1736>:
etc., but on other targets it could have just one comparison per conditional
jump, or on the other side 4. While the tests don't have side-effects, turning
too many &&s into &s wouldn't result in very good code, though of course would
make it easier to perform some optimizations. Anyway, you can write it in the
source as a series of ifs:
array[0] = 1;
if (!b1)
array[0] = 0;
else if (!b2)
array[0] = 0;
else if (!b3)
array[0] = 0;
...
and we wouldn't be able to optimize it anyway.