public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104987] New: [12 Regression] Recent change causing vrp13.c regressions on several targets
@ 2022-03-19 18:12 law at gcc dot gnu.org
  2022-03-21  8:54 ` [Bug tree-optimization/104987] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: law at gcc dot gnu.org @ 2022-03-19 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104987
           Summary: [12 Regression] Recent change causing vrp13.c
                    regressions on several targets
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at gcc dot gnu.org
  Target Milestone: ---

This change:
commit 8db155ddf8cec9e31f0a4b8d80cc67db2c7a26f9 (refs/bisect/bad)
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Mar 17 10:52:10 2022 -0400

    Always use dominators in the cache when available.

    This patch adjusts range_from_dom to follow the dominator tree through the
    cache until value is found, then apply any outgoing ranges encountered
    along the way.  This reduces the amount of cache storage required.

            PR tree-optimization/102943
            * gimple-range-cache.cc (ranger_cache::range_from_dom): Find range
via
            dominators and apply intermediary outgoing edge ranges.

Is causing gcc.dg/tree-ssa/vrp13.c to fail on a couple targets (iq2000-elf,
v850e-elf).

It looks like we're mis-compiling foo_mult.

Here's the reduced testcase:

/* { dg-do run }  */
/* { dg-options -O2 }  */

extern void abort (void);
extern void link_error (void);
int
foo_mult (int i, int j)
{
  int k;

  /* [-20, -10] * [2, 10] should give [-200, -20].  */
  if (i >= -20)
    if (i <= -10)
      if (j >= 2)
        if (j <= 10)
          {
            k = i * j;
            if (k < -200)
              link_error ();
            if (k > -20)
              link_error ();

            return k;
          }

  /* [-20, -10] * [-10, -2] should give [20, 200].  */
  if (i >= -20)
    if (i <= -10)
      if (j >= -10)
        if (j <= -2)
          {
            k = i * j;
            if (k < 20)
              link_error ();
            if (k > 200)
              link_error ();

            return k;
          }

  /* [-20, 10] * [2, 10] should give [-200, 100].  */
  if (i >= -20)
    if (i <= 10)
      if (j >= 2)
        if (j <= 10)
          {
            k = i * j;
            if (k < -200)
              link_error ();
            if (k > 100)
              link_error ();

            return k;
          }

  /* [-20, 10] * [-10, -2] should give [-100, 200].  */
  if (i >= -20)
    if (i <= 10)
      if (j >= -10)
        if (j <= -2)
          {
            k = i * j;
            if (k < -100)
              link_error ();
            if (k > 200)
              link_error ();

            return k;
          }

  /* [10, 20] * [2, 10] should give [20, 200].  */
  if (i >= 10)
    if (i <= 20)
      if (j >= 2)
        if (j <= 10)
          {
            k = i * j;
            if (k < 20)
              link_error ();
            if (k > 200)
              link_error ();

            return k;
          }

  /* [10, 20] * [-10, -2] should give [-200, -20].  */
  if (i >= 10)
    if (i <= 20)
      if (j >= -10)
        if (j <= -2)
          {
            k = i * j;
            if (k < -200)
              link_error ();
            if (k > -20)
              link_error ();

            return k;
          }

  abort ();
}

int
main()
{
  if (foo_mult (10, -2) != -20)
    abort ();

  return 0;
}

The symptom on the v850 is we get the sign wrong on the multiplication.  I
haven't looked into what goes wrong on iq2000-elf.

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

end of thread, other threads:[~2022-04-03 22:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 18:12 [Bug tree-optimization/104987] New: [12 Regression] Recent change causing vrp13.c regressions on several targets law at gcc dot gnu.org
2022-03-21  8:54 ` [Bug tree-optimization/104987] " rguenth at gcc dot gnu.org
2022-03-21 16:59 ` amacleod at redhat dot com
2022-03-21 17:16 ` law at gcc dot gnu.org
2022-03-21 21:16 ` amacleod at redhat dot com
2022-03-23 16:55 ` jakub at gcc dot gnu.org
2022-03-23 16:59 ` jakub at gcc dot gnu.org
2022-03-26 17:41 ` law at gcc dot gnu.org
2022-03-26 23:34 ` law at gcc dot gnu.org
2022-03-27 16:52 ` law at gcc dot gnu.org
2022-04-03 22:24 ` [Bug target/104987] " cvs-commit at gcc dot gnu.org
2022-04-03 22:26 ` law 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).