public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/97456] [10/11 Regression] An incorrect optimization causes a function to always return the same value when using -flto
Date: Fri, 16 Oct 2020 14:51:03 +0000	[thread overview]
Message-ID: <bug-97456-4-1s7ND1uisc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97456-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Looking at Martin's reduced testcase....

(In reply to Richard Biener from comment #2)
> Confirmed with -fwhole-program -O3  IPA SRA messes things up here cloning
> wrong
> and producing the strange
> 
> wrong.isra (floatD.41 ISRA.85D.75004)
> {
[...]
> 
>   <bb 6> [local count: 1073741824]:
> 
>   <bb 2> [local count: 1073741824]:
>   _1 = ISRA.85_10(D);
> 
> eventually mixing up param/replacement here?

...this is simple conversion of a parameter passed by reference to one
passed by value.  I'm good at overlooking things but at least at the
moment I cannot see anything wrong with it.

Rather, I believe it is cplxlower1 which turns

  <bb 2> [local count: 1073741824]:
  a$_M_value_21 = COMPLEX_EXPR <ISRA.18_10(D), ISRA.18_10(D)>;

into:

  <bb 2> [local count: 1073741824]:
  a$_M_value_21 = COMPLEX_EXPR <a$_M_value$real_10(D), a$_M_value$real_10(D)>;

i.e. it replaces two uses of the parameter default-def with two
uninitialized value variable default-defs.

When I disable IPA-SRA, the pass starts with:

  <bb 2> [local count: 1073741824]:
  _1 = *pos_6(D);
  a$_M_value_21 = COMPLEX_EXPR <_1, _1>;

and changes it into:

  <bb 2> [local count: 1073741824]:
  a$_M_value$real_1 = *pos_6(D);
  a$_M_value_21 = COMPLEX_EXPR <a$_M_value$real_1, a$_M_value$real_1>;

...so my hypothesis is that cplxlower does not handle good
default-defs properly.

  parent reply	other threads:[~2020-10-16 14:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 10:25 [Bug c++/97456] New: " pqfrml at gmail dot com
2020-10-16 10:29 ` [Bug c++/97456] " pqfrml at gmail dot com
2020-10-16 11:00 ` [Bug ipa/97456] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-10-16 12:06 ` marxin at gcc dot gnu.org
2020-10-16 14:51 ` jamborm at gcc dot gnu.org [this message]
2020-10-16 15:56 ` jamborm at gcc dot gnu.org
2020-10-16 18:53 ` jamborm at gcc dot gnu.org
2020-10-16 18:54 ` [Bug tree-optimization/97456] " jamborm at gcc dot gnu.org
2020-10-19 17:22 ` cvs-commit at gcc dot gnu.org
2020-10-26 16:33 ` cvs-commit at gcc dot gnu.org
2020-10-26 16:34 ` jamborm at gcc dot gnu.org
2022-03-30 11:51 ` cvs-commit at gcc dot gnu.org
2022-03-30 11:53 ` jamborm 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-97456-4-1s7ND1uisc@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).