public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/109147] New: Missing IPA-VRP for return values
@ 2023-03-15 17:01 jakub at gcc dot gnu.org
  2023-03-15 17:03 ` [Bug testsuite/109147] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-15 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109147
           Summary: Missing IPA-VRP for return values
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: david.spickett at linaro dot org, unassigned at gcc dot gnu.org
        Depends on: 109146
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #109146 +++

I guess we should turn this primarily into an enhancement request to optimize
this.
I believe that is a request for return value ranges in IPA-VRP.

So a testcase could be:
__attribute__((noinline)) static int
foo (int a, int b)
{
  return a == b;
}

int
bar (int a, int b)
{
  return foo (a, b) != 0;
}

__attribute__((noinline)) static int
baz (int a)
{
  if (a > 10 || a < -10)
    return 0;
  return a;
}

int
qux (int a)
{
  return baz (a) == 42;
}

where if we determine that foo always returns [0, 1] and baz [-10, 10], then we
can
optimize that return ret != 0; into return ret; and ret == 42 into 0.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109146
[Bug 109146] Tail call prevention in frame-address.c is not correct

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

end of thread, other threads:[~2023-12-06 18:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 17:01 [Bug testsuite/109147] New: Missing IPA-VRP for return values jakub at gcc dot gnu.org
2023-03-15 17:03 ` [Bug testsuite/109147] " pinskia at gcc dot gnu.org
2023-03-15 17:07 ` jakub at gcc dot gnu.org
2023-03-15 17:16 ` jakub at gcc dot gnu.org
2023-03-15 17:16 ` jakub at gcc dot gnu.org
2023-12-06 18:59 ` 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).