[Bug tree-optimization/120317] Missed DCE with __attribute__((const)) bijection function

2025-05-16 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120317

Xi Ruoyao  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED
 CC||xry111 at gcc dot gnu.org

--- Comment #3 from Xi Ruoyao  ---
Invalid as __attribute__((const)) does NOT imply a bijection.  If you want a
new attribute to denote a bijection please rephrase and reopen.

[Bug tree-optimization/120317] Missed DCE with __attribute__((const)) bijection function

2025-05-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120317

--- Comment #2 from Andrew Pinski  ---
I am not sure this is valid to with documentated const definition.

const does not mean `(arg0 != arg1)` -> `f(arg0) != f(arg1)` and even if you
have `arg0 == g(f(arg0))` as an assumption, that does not mean there is not a
value which causes undefined behavior. It just means the defined range of f (or
g) will have some value where that holds true.

[Bug tree-optimization/120317] Missed DCE with __attribute__((const)) bijection function

2025-05-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120317

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/120317] Missed DCE with __attribute__((const)) bijection function

2025-05-16 Thread kaelfandrew at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120317

Kael Franco  changed:

   What|Removed |Added

  Attachment #61446|0   |1
is obsolete||

--- Comment #1 from Kael Franco  ---
Created attachment 61447
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61447&action=edit
Updated C code

Forgot to check if ARG0 == ARG1 so if(tmp0 == tmp2) can be removed