[Bug tree-optimization/92408] strlen(s) != 0 not folded into *s
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92408 Andrew Pinski changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org --- Comment #4 from Andrew Pinski --- I am going to implement this for GCC 16. forwprop seems like a reasonible place. Basically for a strlen statement that is only used with a comparison with `==/!= 0` get both replaced with `*a ==/!= 0`. Note since result of strlen is unsigned we don't need to handle `>= 1` or `> 1` since those will be replaced with `!= 0`.
[Bug tree-optimization/92408] strlen(s) != 0 not folded into *s
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92408 Andrew Pinski changed: What|Removed |Added CC||pinskia at gcc dot gnu.org --- Comment #3 from Andrew Pinski --- I wonder if this could be done im gimple fold or forwprop.
[Bug tree-optimization/92408] strlen(s) != 0 not folded into *s
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92408 Andrew Pinski changed: What|Removed |Added Ever confirmed|0 |1 Severity|normal |enhancement Status|UNCONFIRMED |NEW Component|middle-end |tree-optimization Last reconfirmed||2021-08-01 --- Comment #2 from Andrew Pinski --- Confirmed. The code is located in fold_binary_loc in fold-const.c, moving it to match.pd might need some patching to support adding of loads in the case of -fnon-call-exceptions.