public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: GCC <gcc@gcc.gnu.org>
Subject: bug in DSE?
Date: Fri, 12 Feb 2021 17:15:10 -0500	[thread overview]
Message-ID: <cbff990c-97c5-2109-353c-3bffebd0d83b@redhat.com> (raw)

I dont't want to immediately open a PR,  so I'll just ask about 
testsuite/gcc.dg/pr83609.c.

the compilation string  is
   -O2 -fno-tree-forwprop -fno-tree-ccp -fno-tree-fre -fno-tree-pre 
-fno-code-hoisting

Which passes as is.

if I however add   -fno-tree-vrp   as well, then it looks like dead 
store maybe does something wong...

with EVRP running, we translate function foo() from


complex float foo ()
{
   complex float c;
   complex float * c.0_1;
   complex float _4;

   <bb 2> :
   c.0_1 = &c;
   MEM[(long long unsigned int *)c.0_1] = 1311768467463790320;
   _4 = c;
   c ={v} {CLOBBER};
   return _4;

}
to

   complex float c;
   complex float _4;

   <bb 2> :
   MEM[(long long unsigned int *)&c] = 1311768467463790320;
   _4 = c;
   c ={v} {CLOBBER};
   return _4;

and everything works fine.

If we don't do EVRP, then DSE takes the original, and reports:

   Deleted dead store: MEM[(long long unsigned int *)c.0_1] = 
1311768467463790320;

transforming it to:

complex float foo ()
{
   complex float c;
   complex float * c.0_1;
   complex float _4;

   <bb 2> :
   c.0_1 = &c;
   _4 = c;
   c ={v} {CLOBBER};
   return _4;

}

That doesn't seem right?

and the place where it is inlined in main() becomes
  <bb 2> :
   _4 = c_11(D);
   _10 = _4;
   _1 = _10;
   u$c_9 = _1;
   _2 = VIEW_CONVERT_EXPR<long long unsigned int>(u$c_9);
   if (_2 != 1311768467463790320)


I not really sure exactly what is going on...  but I do know that the 
testcase aborts() if we turn off VRP :-P

Andrew



             reply	other threads:[~2021-02-12 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 22:15 Andrew MacLeod [this message]
2021-02-12 23:20 ` Marc Glisse
2021-02-13 14:25   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbff990c-97c5-2109-353c-3bffebd0d83b@redhat.com \
    --to=amacleod@redhat.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).