public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100756] [12/13 Regression] vect: Superfluous epilog created on s390x Date: Fri, 21 Oct 2022 12:21:18 +0000 [thread overview] Message-ID: <bug-100756-4-lvZolpEhcp@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100756-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100756 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-10-21 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Summary|vect: Superfluous epilog |[12/13 Regression] vect: |created on s390x |Superfluous epilog created | |on s390x CC| |amacleod at redhat dot com Target Milestone|--- |12.3 Keywords| |missed-optimization --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- I think the issue is that we now have <bb 2> [local count: 118111600]: _15 = n_8(D) * 4; if (n_8(D) > 0) goto <bb 5>; [89.00%] else goto <bb 7>; [11.00%] while we probably had <bb 2> [local count: 118111600]: _15 = n_8(D) * 4; if (_15 > 0) goto <bb 5>; [89.00%] else goto <bb 7>; [11.00%] before the change. Loop header copying applies VN to the copied blocks: Processing block 0: BB6 Value numbering stmt = i_9 = PHI <0(2)> Setting value number of i_9 to 0 (changed) Replaced redundant PHI node defining i_9 with 0 Value numbering stmt = result_14 = PHI <0(2)> Setting value number of result_14 to 0 (changed) Replaced redundant PHI node defining result_14 with 0 Value numbering stmt = _15 = n_8(D) * 4; Setting value number of _15 to _15 (changed) Making available beyond BB6 _15 for value _15 Value numbering stmt = if (_15 > i_9) Recording on edge 6->7 _15 gt_expr 0 == true Recording on edge 6->7 _15 le_expr 0 == false Recording on edge 6->7 _15 ne_expr 0 == true Recording on edge 6->7 _15 ge_expr 0 == true Recording on edge 6->7 _15 lt_expr 0 == false Recording on edge 6->7 _15 eq_expr 0 == false marking outgoing edge 6 -> 7 executable gimple_simplified to if (n_8(D) > 0) with <bb 2> [local count: 118111600]: _15 = n_8(D) * 4; if (n_8(D) > 0) goto <bb 3>; [89.00%] else goto <bb 4>; [11.00%] <bb 3> [local count: 955630225]: # i_16 = PHI <i_13(3), 0(2)> # result_17 = PHI <result_12(3), 0(2)> _1 = (long unsigned int) i_16; _2 = _1 * 4; _3 = a_11(D) + _2; _4 = *_3; result_12 = _4 + result_17; i_13 = i_16 + 1; _5 = n_8(D) * 4; if (_5 > i_13) goto <bb 3>; [89.00%] else goto <bb 4>; [11.00%] so it was a single use in the compare (because CSE only later introduces more uses through DOM). The niter code then ends up with maybe-zero as _15 <= 0 and a condition of n_8(D) > 0 it tries to simplify with tree_simplify_using_condition (called from simplify_using_initial_conditions). That old machinery would be a perfect candidate to be rewritten using path ranger, but in a somewhat extended mode that can "skip" diamonds, aka, the path just contains dominators of the loop entry edge on which we want to evaluate the _15 <= 0 condition. To make the old simplification code work we can do the following: diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc index 1e0f609d8b6..4ffcef4f4ff 100644 --- a/gcc/tree-ssa-loop-niter.cc +++ b/gcc/tree-ssa-loop-niter.cc @@ -2216,6 +2216,7 @@ expand_simple_operations (tree expr, tree stop, hash_map<tree, tree> &cache) case PLUS_EXPR: case MINUS_EXPR: + case MULT_EXPR: if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (expr)) && TYPE_OVERFLOW_TRAPS (TREE_TYPE (expr))) return expr; but that can of course have unintended side-effects elsewhere (this function is also used by IVOPTs).
next prev parent reply other threads:[~2022-10-21 12:21 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-25 16:22 [Bug tree-optimization/100756] New: " rdapp at linux dot ibm.com 2021-05-26 7:39 ` [Bug tree-optimization/100756] " rguenth at gcc dot gnu.org 2022-03-25 9:45 ` rdapp at linux dot ibm.com 2022-03-25 9:53 ` rguenth at gcc dot gnu.org 2022-10-20 12:04 ` rdapp at gcc dot gnu.org 2022-10-21 12:21 ` rguenth at gcc dot gnu.org [this message] 2022-10-25 8:03 ` [Bug tree-optimization/100756] [12/13 Regression] " cvs-commit at gcc dot gnu.org 2022-10-25 8:03 ` [Bug tree-optimization/100756] [12 " rguenth at gcc dot gnu.org 2022-10-25 8:03 ` rguenth at gcc dot gnu.org 2023-02-01 9:31 ` rguenth at gcc dot gnu.org 2023-02-01 9:59 ` rdapp at gcc dot gnu.org 2023-05-08 12:22 ` rguenth at gcc dot gnu.org 2024-06-20 8:56 ` rguenth at gcc dot gnu.org 2024-06-20 10:22 ` rdapp at gcc dot gnu.org 2024-06-20 11:39 ` 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-100756-4-lvZolpEhcp@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: linkBe 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).