https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117776
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |TREE --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Here is a reduced testcase for the missed optimization also dealing with Canonical form here. ``` static inline bool even (unsigned char t) { return (t%2) == 0; } unsigned char f(unsigned char t) { unsigned char y = even(t); unsigned int l = even(t); unsigned int l1 = y; return l1 == l; } ``` `& 1` is the canonical form even though the cast might look better because logical operators are better at being handled than casts (especially casts to bool).