From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id CF6B13858CDA; Tue, 9 Apr 2024 07:29:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF6B13858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712647777; bh=18AyIq3+8NN1dRc5+6R0nxOS0VcwAdiwqqlyDpQxh3E=; h=From:To:Subject:Date:From; b=Us7xCIv9zMZv39gV5FhIyszmbQqC9BxuomvlRms0HLove+TAdyt8jJD+g+PF8cOA8 e3/OYmmgxmDsIklnkdYCF02Dg7Xd2x6t81HO1QfYBZ66D4cD7ljrWppdDBjWv3WKzy iZcRGCUZCA/zxkP8wsZo6iqGEdePYIl5nyqtm7Ew= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9859] bitint: Don't move debug stmts from before returns_twice calls [PR114628] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 46c91665f4bceba19aed56f5bd6e934c548b84ff X-Git-Newrev: 7dd1f9d2ec422173f490d91b9173d4fa5d32d909 Message-Id: <20240409072937.CF6B13858CDA@sourceware.org> Date: Tue, 9 Apr 2024 07:29:37 +0000 (GMT) List-Id: https://gcc.gnu.org/g:7dd1f9d2ec422173f490d91b9173d4fa5d32d909 commit r14-9859-g7dd1f9d2ec422173f490d91b9173d4fa5d32d909 Author: Jakub Jelinek Date: Tue Apr 9 09:28:27 2024 +0200 bitint: Don't move debug stmts from before returns_twice calls [PR114628] Debug stmts are allowed by the verifier before the returns_twice calls. More importantly, they don't have a lhs, so the current handling of arg_stmts statements to force them on the edges ICEs. The following patch just keeps them where they were before. 2024-04-09 Jakub Jelinek PR middle-end/114628 * gimple-lower-bitint.cc (gimple_lower_bitint): Keep debug stmts before returns_twice calls as is, don't push them into arg_stmts vector/move to edges. * gcc.dg/bitint-105.c: New test. Diff: --- gcc/gimple-lower-bitint.cc | 9 +++++++-- gcc/testsuite/gcc.dg/bitint-105.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc index 1afd4de445a..4c3b7f7b68e 100644 --- a/gcc/gimple-lower-bitint.cc +++ b/gcc/gimple-lower-bitint.cc @@ -7172,8 +7172,13 @@ gimple_lower_bitint (void) gimple_stmt_iterator gsi = gsi_after_labels (gimple_bb (stmt)); while (gsi_stmt (gsi) != stmt) { - arg_stmts.safe_push (gsi_stmt (gsi)); - gsi_remove (&gsi, false); + if (is_gimple_debug (gsi_stmt (gsi))) + gsi_next (&gsi); + else + { + arg_stmts.safe_push (gsi_stmt (gsi)); + gsi_remove (&gsi, false); + } } gimple *g; basic_block bb = NULL; diff --git a/gcc/testsuite/gcc.dg/bitint-105.c b/gcc/testsuite/gcc.dg/bitint-105.c new file mode 100644 index 00000000000..d3215b1d473 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-105.c @@ -0,0 +1,29 @@ +/* PR middle-end/114628 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-O2 -g" } */ + +int foo (int); +#if __BITINT_MAXWIDTH__ >= 129 +__attribute__((returns_twice)) int bar (_BitInt(129) x); + +void +baz (int x, _BitInt(129) y) +{ + void *q[] = { &&l1, &&l2 }; +l2: + x = foo (foo (3)); + bar (y); + goto *q[x & 1]; +l1:; +} + +void +qux (int x, _BitInt(129) y) +{ + void *q[] = { &&l1, &&l2 }; +l2: + x = foo (foo (3)); + bar (y); +l1:; +} +#endif