[Bug tree-optimization/125756] nonnegative < (typeof nonnegative)(nonnegative != 0) is false
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 11 20:49:11 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125756
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Kael Franco from comment #1)
> Is it appropriate to have meta bug about missed optimization in match.pd due
> to TYPE_UNSIGNED being checked rather than checking nonnegative of capture?
I don't think we need one in this case, I just finished my audit of match.pd
even for these cases. Since all of them are easy hacks; they are all easy to be
found.
> My patches in Bug 125641 and 125707 could be adjusted if needed?
PR 125641 uses TYPE_UNSIGNED to signify if the right shift is logical shift
(non-sign extending) or arithmetic shift (copying the sign bit) so that does
not need to be changed. And we need the sign bit to be copied.
for non-negative case `a>>signbit ` will be known to be 0 so it should already
be simplified into just `a` :).
PR 125707 has the same effect there.
More information about the Gcc-bugs
mailing list