public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99755] failure to fold a conditional that's a subset of another expression Date: Thu, 25 Mar 2021 13:52:18 +0000 [thread overview] Message-ID: <bug-99755-4-CgrUaPBIHs@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99755-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99755 Andrew Macleod <amacleod at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com --- Comment #2 from Andrew Macleod <amacleod at redhat dot com> --- f2 and f4 are "similar" when I look at whats going on with these. The interesting bits are bb3 and bb4 =========== BB 3 ============ i_9(D) int [2, +INF] j_10(D) int [3, +INF] Relational : (x_12 > i_9(D)) <bb 3> : x_12 = i_9(D) + 1; x_12 : int [3, +INF] =========== BB 4 ============ Imports: i_9(D) j_10(D) Exports: _4 _5 _6 i_9(D) j_10(D) _4 : i_9(D)(I) _5 : j_10(D)(I) _6 : _4 _5 i_9(D)(I) j_10(D)(I) i_9(D) int VARYING j_10(D) int VARYING <bb 4> : # x_8 = PHI <x_11(D)(2), x_12(3)> _4 = i_9(D) == 2; _5 = j_10(D) == 3; _6 = _4 & _5; if (_6 != 0) goto <bb 5>; [INV] else goto <bb 7>; [INV] x_8 : int [3, +INF] 4->5 (T) _4 : _Bool [1, 1] 4->5 (T) _5 : _Bool [1, 1] 4->5 (T) _6 : _Bool [1, 1] 4->5 (T) i_9(D) : int [2, 2] 4->5 (T) j_10(D) : int [3, 3] 4->7 (F) _6 : _Bool [0, 0] we have the ability to recompute stmts on edges when the dependencies change. This currently applies only to range-ops enabled stmts. An extension to PHIS and other non-range-ops is in the works. The gist being x_8 is directly dependant on x_11 and x_12. x_11 is undefined, so it boils down to a dependency on x_12. x_12 in turn is dependant on i_9 which is a modified export from this block. So when recomputation is extended to PHIS, we should be able to see that i_9 has changed on this edge, and reevaluate x_12 for that edge, x_12 = i_9 + 1 --> [2,2] + 1 == [3,3] and feeding that into a PHI recalculation for the edge producing x_8 = PHI <x_11(D), [3,3]> and then we'd resolve x_8 = [3,3] on the true edge, and the desired fold should happen. The other issue is that when we do recalculations, we currently only go back one degree of dependency for the sake of compilation speed... x_8's direct dependencies are that one degree.. I have not done experiments on more than one degree, but it may make sense to look back one degree for phi arguemnts as well, which would then get cases like this. It may also make sense instead to adjust the phi optimization pass to utilize ranger to do a more in-depth analysis of argument ranges and their dependencies and get it there. I'll update this once I have enabled recomputation for phis, and have something more concrete.
next prev parent reply other threads:[~2021-03-25 13:52 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-24 23:36 [Bug tree-optimization/99755] New: " msebor at gcc dot gnu.org 2021-03-25 7:57 ` [Bug tree-optimization/99755] " rguenth at gcc dot gnu.org 2021-03-25 13:52 ` amacleod at redhat dot com [this message] 2022-01-12 0:39 ` amacleod at redhat dot com
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-99755-4-CgrUaPBIHs@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).