public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111957] New: `a ? abs(a) : 0` is not simplified to just abs(a)
@ 2023-10-24 16:15 pinskia at gcc dot gnu.org
  2023-10-24 16:15 ` [Bug tree-optimization/111957] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-24 16:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111957

            Bug ID: 111957
           Summary: `a ? abs(a) : 0` is not simplified to just abs(a)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
int f(int a)
{
  if (a)
  return a > 0 ? a : -a;
  return 0;
}
```

This should just simplify to ` return a > 0 ? a : -a;` or rather `return
abs(a);`

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-26 18:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24 16:15 [Bug tree-optimization/111957] New: `a ? abs(a) : 0` is not simplified to just abs(a) pinskia at gcc dot gnu.org
2023-10-24 16:15 ` [Bug tree-optimization/111957] " pinskia at gcc dot gnu.org
2023-10-24 22:37 ` pinskia at gcc dot gnu.org
2023-10-24 23:35 ` pinskia at gcc dot gnu.org
2023-10-25  3:43 ` pinskia at gcc dot gnu.org
2023-10-26 18:58 ` cvs-commit at gcc dot gnu.org
2023-10-26 18:58 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).