[Bug tree-optimization/51783] Missed optimization for X ==/!= (signed type) ((unsigned type) Y + Z)

2021-05-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51783 --- Comment #5 from Andrew Pinski --- The problem with the conversion that is suggested here is the addition if changed into a signed type might have an undefined behavior when it comes to an overflow. It does not matter if it is used later

[Bug tree-optimization/51783] Missed optimization for X ==/!= (signed type) ((unsigned type) Y + Z)

2012-01-07 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51783 --- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org 2012-01-07 18:25:19 UTC --- I think that would be an invalid transformation except when -fwrapv is used. The reason is: x.0_2 = (unsigned int) x_1(D); D.2715_4 = z_3(D) + x.0_2;

[Bug tree-optimization/51783] Missed optimization for X ==/!= (signed type) ((unsigned type) Y + Z)

2012-01-07 Thread ktietz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51783 --- Comment #2 from Kai Tietz ktietz at gcc dot gnu.org 2012-01-07 18:55:05 UTC --- Well, IMHO it is still valid in the case of argument of ne/eq comparison, as indeed here sign and wrap-around doesn't matter.

[Bug tree-optimization/51783] Missed optimization for X ==/!= (signed type) ((unsigned type) Y + Z)

2012-01-07 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51783 --- Comment #3 from Andrew Pinski pinskia at gcc dot gnu.org 2012-01-07 18:57:52 UTC --- (In reply to comment #2) Well, IMHO it is still valid in the case of argument of ne/eq comparison, as indeed here sign and wrap-around doesn't matter.

[Bug tree-optimization/51783] Missed optimization for X ==/!= (signed type) ((unsigned type) Y + Z)

2012-01-07 Thread ktietz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51783 --- Comment #4 from Kai Tietz ktietz at gcc dot gnu.org 2012-01-07 19:04:13 UTC --- Hmm, here I disagree. See other ==/!= comparison missed optimization. Eg for 'x == (signed type)((unsigned type) x + z)' the transformation is profitable, as it