[Bug tree-optimization/15826] don't use "if" to extract a single bit bit-field.
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jun 4 19:26:00 GMT 2004
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-04 19:26 -------
Here is another example:
struct s {
unsigned int bit : 1;
};
unsigned int
foo (struct s *p)
{
int i;
if (p->bit)
i = 1;
else
i = 0;
return i;
}
I will note that the example in comment #1 needs to have the return values merged together before the
real optimization happens (see PR 15268 and a patch which I posted but have not gotten around to
answering/tying RTH's question/seguestion yet).
But basically it can be optimization by putting a cast to bool first so a != 0 becomes (bool)a and PHI-
opt already optimizated out the branches.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |15268
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15826
More information about the Gcc-bugs
mailing list