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/101496] [12 Regression] ice during GIMPLE pass: evrp Date: Mon, 19 Jul 2021 18:44:04 +0000 [thread overview] Message-ID: <bug-101496-4-TmWmFft1XY@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101496-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101496 Andrew Macleod <amacleod at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-07-19 Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 --- Comment #6 from Andrew Macleod <amacleod at redhat dot com> --- This test case has unreachable code in it. This issue comes down to func_14_s_5.0_1 = func_14_s_5; _2 = func_14_s_5.0_1 < 0; c_1.2_4 = c_1; _5 = func_14_s_5.0_1 != c_1.2_4; _6 = _2 | _5; _7 = (int) _6; us_3.3_8 = us_3; _9 = _7 | us_3.3_8; us_3 = _9; us_3.6_11 = (unsigned int) _9; if (us_3.6_11 == 0) goto <bb 4>; [INV] else goto <bb 9>; [INV] We determine that in order for us_3.6_11 to be == 0 and take the branch to bb4, that _9, _7, _2 and _5 must all also be 0. This means that _5 = func_14_s_5.0_1 != c_1.2_4; must be false, which then means that func_14_s_5.0_1 == c_1.2_4 _2 being false also means func_14_s_5.0_1 >= 0 or [0, +INF] Next: <bb 4> : _16 = c_1.2_4 >= _9; _17 = (unsigned int) _16; if (_17 != 0) goto <bb 9>; [INV] else goto <bb 5>; [INV] to take the branch to bb5, c_1.2_4 must be < _9, (_9 is known to be [0,0].. meaning its range would be [-INF, -1]. we arent fully exploiting equivalences yet, so we dont fold this branch, even though we potentially could. With func_14_s_5.0_1 == c_1.2_4, that means c_1.2_4 will enter this branch with the range [0, +INF] which means it can never be < _9 and we will always branch to BB 9. We currently miss that fold, so don't realize yet that bb_5 in unreachable. but this leads us to the next branch, which is causing the problem: <bb 6> : if (func_14_s_5.0_1 <= c_1.2_4) goto <bb 8>; [INV] else goto <bb 7>; [INV] Ranger first tries to fold with relations, so it determines that this is always TRUE since func_14_s_5.0_1 == c_1.2_4. The simplification code still has legacy support in it, and confirms that whatever we come up with the with new range API matches the old code. The old code says func_14_s_5.0_1 == [0, +INF], and c_1.2_4 == [-INF, -1], so this branch is never taken.. result is FALSE. Now an assert it tripped saying the 2 approaches do not agree on which edge would be taken. The code is unreachable.. so it doesnt really matter. To fix this, I am tweaking the simplification code for now to simply use the value the new API returns, if it returns one. Otherwise, it then checks the old API and the only time it is allowed to find a taken edge is if the NEW API says the fold is undefined. Eventually we can remove that too, but for now, I leave it as a sanity check to ensure we dont find something important, and it is harmless for the OLD API code to remove unreachable code. This function eventually folds to <bb 2> [local count: 10631108]: <bb 3> [local count: 1073741824]: goto <bb 3>;
next prev parent reply other threads:[~2021-07-19 18:44 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-18 7:42 [Bug c/101496] New: " dcb314 at hotmail dot com 2021-07-18 7:51 ` [Bug tree-optimization/101496] [12 Regression] " pinskia at gcc dot gnu.org 2021-07-18 7:53 ` pinskia at gcc dot gnu.org 2021-07-18 9:12 ` dcb314 at hotmail dot com 2021-07-18 9:44 ` dcb314 at hotmail dot com 2021-07-18 9:59 ` dcb314 at hotmail dot com 2021-07-18 10:28 ` dcb314 at hotmail dot com 2021-07-19 6:36 ` rguenth at gcc dot gnu.org 2021-07-19 18:44 ` amacleod at redhat dot com [this message] 2021-07-22 12:53 ` cvs-commit at gcc dot gnu.org 2021-07-22 13:07 ` 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-101496-4-TmWmFft1XY@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).