public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/107176] [10/11/12/13 Regression] Wrong code at -Os on x86_64-pc-linux-gnu since r7-2012-g43aabfcfd4139e4c
Date: Tue, 25 Oct 2022 11:40:25 +0000	[thread overview]
Message-ID: <bug-107176-4-xkCMcGpCwb@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107176-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:4c5b1160776382772fc0a33130dfaf621699fdbf

commit r13-3486-g4c5b1160776382772fc0a33130dfaf621699fdbf
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Oct 24 08:52:12 2022 +0200

    tree-optimization/107176 - SCEV analysis association issue

    The following fixes a wrong-code issue caused by SCEV analysis
    associating an addition due trying to use tail-recursion in
    follow_ssa_edge_expr.  That causes us to apply a conversion at
    the wrong point and thus miscompute the scalar evolution of
    an induction variable.  This reverts the PR66375 fix and
    revisits the PR42512 fix by keeping the evolution symbolic
    up to the point we process the first linear function when
    we then can check for the supported cases and substitute the
    whole symbolic expression with the built chrec substituting
    the proper initial value.

    To simplify passing around things and to clarify scoping of
    the involved functions this change wraps the SCEV DFS walking
    code into a class.

            PR tree-optimization/107176
            PR tree-optimization/66375
            PR tree-optimization/42512
            * tree-scalar-evolution.cc (follow_ssa_edge_expr): Revert
            the PR66375 fix, do not not associate PLUS_EXPR to be able
            to use tail-recursion.
            (follow_ssa_edge_binary): Likewise.
            (interpret_loop_phi): Revert PR42512 fix, do not throw
            away analyze_evolution_in_loop result after the fact.
            (follow_ssa_edge_expr): When reaching halting_phi initalize
            the evolution to the symbolic value of the PHI result.
            (add_to_evolution_1): When adding the first evolution verify
            we can handle the expression wrapping the symbolic evolution
            and replace that in full using the initial condition.
            (class scev_dfs): New, contains ...
            (follow_ssa_edge_expr, follow_ssa_edge_binary,
            follow_ssa_edge_in_condition_phi_branch,
            follow_ssa_edge_in_condition_phi,
            follow_ssa_edge_inner_loop_phi,
            add_to_evolution, add_to_evolution_1): ... these with
            loop and halting_phi arguments in class data.
            (scev_dfs::get_ev): New toplevel DFS entry, start with
            a chrec_dont_know evolution.
            (analyze_evolution_in_loop): Use scev_dfs.

            * gcc.dg/torture/pr107176.c: New testcase.

  parent reply	other threads:[~2022-10-25 11:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 20:41 [Bug c/107176] New: Wrong code at -O0/-Os on x86_64-pc-linux-gnu shaohua.li at inf dot ethz.ch
2022-10-06 20:50 ` [Bug tree-optimization/107176] [10/11/12/13 Regression] Wrong code at -Os " pinskia at gcc dot gnu.org
2022-10-07  7:30 ` rguenth at gcc dot gnu.org
2022-10-07 14:36 ` [Bug tree-optimization/107176] [10/11/12/13 Regression] Wrong code at -Os on x86_64-pc-linux-gnu since r7-2012-g43aabfcfd4139e4c marxin at gcc dot gnu.org
2022-10-18  8:35 ` rguenth at gcc dot gnu.org
2022-10-21 13:25 ` rguenth at gcc dot gnu.org
2022-10-24  8:30 ` rguenth at gcc dot gnu.org
2022-10-24  9:54 ` rguenth at gcc dot gnu.org
2022-10-24 13:31 ` rguenth at gcc dot gnu.org
2022-10-25 11:40 ` cvs-commit at gcc dot gnu.org [this message]
2022-10-25 11:41 ` [Bug tree-optimization/107176] [10/11/12 " rguenth at gcc dot gnu.org
2022-11-28 10:18 ` rguenth at gcc dot gnu.org
2023-07-07 10:44 ` [Bug tree-optimization/107176] [11/12 " rguenth 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-107176-4-xkCMcGpCwb@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).