public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/96722] [8/9/10/11 Regression] Clobbers on NULL since r8-1519
Date: Thu, 20 Aug 2020 13:59:25 +0000	[thread overview]
Message-ID: <bug-96722-4-rKKLYXglDW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96722-4@http.gcc.gnu.org/bugzilla/>

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|marxin at gcc dot gnu.org          |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
So the problematic transformation happens in einline:

BEFORE:

void foo(S*) (struct S * a)
{
  <bb 2> [0.00%] [count: INV]:
  if (a_2(D) != 0B)
    goto <bb 4>; [0.00%] [count: INV]
  else
    goto <bb 3>; [0.00%] [count: INV]

  <bb 3> [100.00%] [count: INV]:
  MEM[(struct  &)a_2(D)] ={v} {CLOBBER};

  <bb 4> [0.00%] [count: INV]:
  return;

}

after:

void foo(S*) (struct S * a)
{
  <bb 2> [0.00%] [count: INV]:
  if (a_2(D) != 0B)
    goto <bb 3>; [0.00%] [count: INV]
  else
    goto <bb 4>; [0.00%] [count: INV]

  <bb 3> [0.00%] [count: INV]:
  // predicted unlikely by early return (on trees) predictor.
  goto <bb 5>; [0.00%] [count: INV]

  <bb 4> [100.00%] [count: INV]:
  MEM[(struct  &)a_2(D)] ={v} {CLOBBER};

  <bb 5> [0.00%] [count: INV]:
  return;

}

So as seen, the CFG is more complex as there's an extra GIMPLE_PREDICT.

main then inlines to:

Scope blocks after cleanups:

{ Scope block #0 

  { Scope block #7 ../pr96722.C:8 Originating from :  extern void S (struct S
*, int); 

  }

  { Scope block #8 ../pr96722.C:14 Originating from :  extern void S (struct S
*, int); 

  }

}
int main() ()
{
  int _5;

  <bb 2> [100.00%] [count: INV]:
  _5 = 0;
  return _5;

}

No longer having address taken: s
Scope blocks after cleanups:

{ Scope block #0 

  { Scope block #7 ../pr96722.C:8 Originating from :  extern void S (struct S
*, int); 

    { Scope block #8 Originating from :#0 

    }

  }

  { Scope block #9 ../pr96722.C:14 Originating from :  extern void S (struct S
*, int); 

  }

}
int main() ()
{
  int _5;

  <bb 2> [100.00%] [count: INV]:
  MEM[(struct  &)0B] ={v} {CLOBBER};
  _5 = 0;
  return _5;

}

So I bet it's hidden in a CFG cleanup where it somehow removes the clobber?
I guess it was latent before my revision..

  parent reply	other threads:[~2020-08-20 13:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20  9:30 [Bug tree-optimization/96722] New: " jakub at gcc dot gnu.org
2020-08-20  9:30 ` [Bug tree-optimization/96722] " jakub at gcc dot gnu.org
2020-08-20  9:39 ` marxin at gcc dot gnu.org
2020-08-20 13:59 ` marxin at gcc dot gnu.org [this message]
2020-08-24 11:30 ` jakub at gcc dot gnu.org
2020-08-24 12:08 ` rguenther at suse dot de
2020-08-24 13:07 ` jakub at gcc dot gnu.org
2020-08-24 13:49 ` rguenth at gcc dot gnu.org
2020-08-25 11:50 ` cvs-commit at gcc dot gnu.org
2020-08-25 17:45 ` cvs-commit at gcc dot gnu.org
2020-08-25 18:26 ` jakub at gcc dot gnu.org
2020-09-01  8:33 ` rguenth at gcc dot gnu.org
2020-09-01 10:56 ` [Bug tree-optimization/96722] [8/9 " jakub at gcc dot gnu.org
2020-09-16 19:23 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:58 ` jakub at gcc dot gnu.org

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=bug-96722-4-rKKLYXglDW@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).