public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] tree-optimization/98786 - fix issue with phiopt and abnormals Date: Fri, 14 May 2021 14:57:13 +0000 (GMT) [thread overview] Message-ID: <20210514145713.3D8743943429@sourceware.org> (raw) https://gcc.gnu.org/g:8f9f9d6065d1906b37a0dc1f2407124dcb09ee27 commit 8f9f9d6065d1906b37a0dc1f2407124dcb09ee27 Author: Richard Biener <rguenther@suse.de> Date: Fri Jan 22 10:34:42 2021 +0100 tree-optimization/98786 - fix issue with phiopt and abnormals This fixes factor_out_conditional_conversion to avoid creating overlapping lifetimes for abnormals. 2021-01-22 Richard Biener <rguenther@suse.de> PR tree-optimization/98786 * tree-ssa-phiopt.c (factor_out_conditional_conversion): Avoid adding new uses of abnormals. * gcc.dg/torture/pr98786.c: New testcase. (cherry picked from commit 329f730fd1daa7cdae4a637244d4e215f9bb9a8c) Diff: --- gcc/testsuite/gcc.dg/torture/pr98786.c | 23 +++++++++++++++++++++++ gcc/tree-ssa-phiopt.c | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/gcc/testsuite/gcc.dg/torture/pr98786.c b/gcc/testsuite/gcc.dg/torture/pr98786.c new file mode 100644 index 00000000000..ea364717af2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr98786.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-tree-dce" } */ + +void +func_30 (void); + +int __attribute__ ((pure, returns_twice)) +func_38 (int g_15, int p_39) +{ + return !!g_15 ? p_39 : 0; +} + +void +func_26 (int func_26___trans_tmp_1) +{ + long int l_37 = 0; + int __trans_tmp_1; + + func_26___trans_tmp_1 = func_38 (func_26___trans_tmp_1, 1); + __trans_tmp_1 = func_38 (func_26___trans_tmp_1, l_37); + l_37 = 1; + func_30 (); +} diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index c6826cb87a2..96c43eab937 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -451,6 +451,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi, if (!is_gimple_reg_type (TREE_TYPE (new_arg0))) return NULL; } + if (TREE_CODE (new_arg0) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_arg0)) + return NULL; if (TREE_CODE (arg1) == SSA_NAME) { @@ -465,6 +468,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi, new_arg1 = gimple_assign_rhs1 (arg1_def_stmt); if (convert_code == VIEW_CONVERT_EXPR) new_arg1 = TREE_OPERAND (new_arg1, 0); + if (TREE_CODE (new_arg1) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_arg1)) + return NULL; } else {
reply other threads:[~2021-05-14 14:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210514145713.3D8743943429@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@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).