This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ipa/81323] New: IPA-VRP doesn't handle return values


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

            Bug ID: 81323
           Summary: IPA-VRP doesn't handle return values
           Product: gcc
           Version: 7.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

__attribute__((noinline)) int foo (void)
{
  __builtin_printf ("foo\n");
  return 3;
}

int
bar (void)
{
  int x = foo ();
  return x >= 2 && x <= 4;
}

Shouldn't we be able to optimize bar to foo (); return 1; with -fipa-vrp or
-fipa-cp, at least when foo binds to the current definition (-fno-pic)?
If we have a constant or a value range for the return value, can't we use that
in the callers?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]