public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/55936] New: Missed VRP optimization
@ 2013-01-10 16:51 law at redhat dot com
  2013-01-11 10:48 ` [Bug tree-optimization/55936] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: law at redhat dot com @ 2013-01-10 16:51 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55936

             Bug #: 55936
           Summary: Missed VRP optimization
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: law@redhat.com


gcc.dg/tree-ssa/vrp06.c looks like:

foo (int i, int j, int a)
{
  if (i >= 10)
    if (i <= 30)
      if (i == j)
        {
          a--;

          /* This should fold to 'if (0)'.  */
          if (i < 0)
            i = baz ();

          /* This should fold to 'if (1)'.  */
          if (j > 0)
            a--;

          /* This should fold to 'if (0)'.  */
          if (i != j)
            return 0;
        }

  return i + a + j;
}


VRP is supposed to optimize away the 3 innermost conditions in a single pass;
the key being to realize that the test i < 0 is always false and thus i does
not vary (nor does j vary).  Once i & j are determined to have non-varying
values, we should be able to optimize away the i != j test because we're in the
true clause if the i == j test.

Unfortunately, VRP drops i to varying and it's unable to optimize away the last
test during the first VRP pass.  It does get optimized later.


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

end of thread, other threads:[~2015-06-26 20:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-10 16:51 [Bug tree-optimization/55936] New: Missed VRP optimization law at redhat dot com
2013-01-11 10:48 ` [Bug tree-optimization/55936] " rguenth at gcc dot gnu.org
2013-01-11 10:55 ` [Bug tree-optimization/55936] [4.6/4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2013-01-11 13:37 ` rguenth at gcc dot gnu.org
2013-01-15 19:42 ` [Bug tree-optimization/55936] [4.6/4.7/4.8/4.9 " jakub at gcc dot gnu.org
2013-10-25 12:15 ` [Bug tree-optimization/55936] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
2013-10-25 12:16 ` rguenth at gcc dot gnu.org
2014-04-22 11:36 ` [Bug tree-optimization/55936] [4.7/4.8/4.9/4.10 " jakub at gcc dot gnu.org
2014-07-16 13:31 ` [Bug tree-optimization/55936] [4.8/4.9/4.10 " jakub at gcc dot gnu.org
2014-10-30 10:39 ` [Bug tree-optimization/55936] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-06-26 20:33 ` [Bug tree-optimization/55936] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:37 ` jakub 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).