public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "qinzhao at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111407] New: ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge Date: Wed, 13 Sep 2023 16:39:34 +0000 [thread overview] Message-ID: <bug-111407-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111407 Bug ID: 111407 Summary: ICE: SSA corruption due to widening_mul opt on conflict across an abnormal edge Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- this bug was originally reported against GCC8.5 with profiling feedback. there were multiple similar failures due to this issue for our large application. Although we reduced the testing case to a very small size, and changed the variable names. the failure can only be repeated with -fprofile-use and the .gcda files. As a result, we cannot expose the testing case. With the small testing case, and debugging into GCC8, I finally locate the issue is: this is a bug in tree-ssa-math-opts.cc, when applying the widening mul optimization, The compiler needs to check whether the operand is in a ABNORMAL PHI, if YES, we should avoid the transformation. the following patch against GCC8 can fix the failure very well: diff -u -r -N -p gcc-8.5.0-20210514-org/gcc/tree-ssa-math-opts.c gcc-8.5.0-20210514/gcc/tree-ssa-math-opts.c --- gcc-8.5.0-20210514-org/gcc/tree-ssa-math-opts.c 2023-09-11 21:04:17.891403319 +0000 +++ gcc-8.5.0-20210514/gcc/tree-ssa-math-opts.c 2023-09-13 15:35:44.962336530 +0000 @@ -2346,6 +2346,14 @@ convert_mult_to_widen (gimple *stmt, gim if (!is_widening_mult_p (stmt, &type1, &rhs1, &type2, &rhs2)) return false; + /* if any one of rhs1 and rhs2 is subjust to abnormal coalescing + * avoid the tranform. */ + if ((TREE_CODE (rhs1) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)) + || (TREE_CODE (rhs2) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs2))) + return false; + to_mode = SCALAR_INT_TYPE_MODE (type); from_mode = SCALAR_INT_TYPE_MODE (type1); if (to_mode == from_mode) I checked the latest upstream GCC14, and found that the function "convert_mult_to_widen" has the same issue, need to be patched as well.
next reply other threads:[~2023-09-13 16:39 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-13 16:39 qinzhao at gcc dot gnu.org [this message] 2023-09-13 17:02 ` [Bug tree-optimization/111407] " pinskia at gcc dot gnu.org 2023-09-13 17:04 ` pinskia at gcc dot gnu.org 2023-09-13 17:05 ` qinzhao at gcc dot gnu.org 2023-09-13 17:06 ` qinzhao at gcc dot gnu.org 2023-09-13 17:14 ` pinskia at gcc dot gnu.org 2023-09-13 17:26 ` pinskia at gcc dot gnu.org 2023-09-13 18:19 ` qinzhao at gcc dot gnu.org 2023-09-13 18:52 ` qinzhao at gcc dot gnu.org 2023-09-15 13:47 ` cvs-commit at gcc dot gnu.org 2023-09-15 13:56 ` qinzhao at gcc dot gnu.org 2024-02-29 7:36 ` [Bug tree-optimization/111407] [11/12/13 Regression] " pinskia at gcc dot gnu.org 2024-02-29 7:37 ` pinskia at gcc dot gnu.org 2024-02-29 14:43 ` qinzhao at gcc dot gnu.org 2024-04-02 14:50 ` cvs-commit at gcc dot gnu.org 2024-04-02 15:56 ` cvs-commit at gcc dot gnu.org 2024-04-02 16:54 ` cvs-commit at gcc dot gnu.org 2024-04-02 16:56 ` qinzhao 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-111407-4@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).