From patchwork Tue Apr 9 06:37:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 88219 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 85BC8385841E for ; Tue, 9 Apr 2024 06:38:20 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A244A3858CD1 for ; Tue, 9 Apr 2024 06:37:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A244A3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A244A3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712644674; cv=none; b=BKwPsCd05lSe40wwH3wXD3y/n39BmakUX490XiwqfoLPqjJY8yHDMe2xgB3vq4TC3c1VsRIg5nnDVosjRlFeeTF+3gnDDqy78kZ4mLAJ0PKlrqVVOjb8aApKQKwVtCeaL/mLXIynvVHZLO9gM7TRTk2RhtVP+pHiRxVQWnCzOrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712644674; c=relaxed/simple; bh=kWQhxU5MNXUlvY+RB0HF59+K/MI348lNvS/Mu8dAq3w=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=PcjpzUbYBl9PIS6HQIBVS6RGrrvIubwMoogFXK/b4nulURgPhfvQDiIshNUe+43rO8y096deSxOM+qmW7Kwlr6+z1LJa1R4Fgr33CvOHLDMx6VUMntli/u/FGTHWWjskf/HYdTxEhjE1onDuq5J+vpeIhvd3ASPudAJ3y9Cj0rs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712644672; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=Xdk/vWWriS5vAz097JoE1cqUJGSEQMglvYjEk3nFVaQ=; b=cmE+oh71j5P/lXhmUWXM/d1tw0qoOeXtpk3k9c5+1UxhNaljcsXzE/bkwJh0ob1MtXj9fZ SGjo+gK6TygnfJTuUsWjAXgZpQfsndFuyP2vzAFAmPNLnEbZrgvp02Fsw+GsNUiljkyTG8 aV6TKY6FJXmt8Scu2/ZlG3R4ad6uuNA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-1idZ8AVZMdG1S-MuiAAw1A-1; Tue, 09 Apr 2024 02:37:48 -0400 X-MC-Unique: 1idZ8AVZMdG1S-MuiAAw1A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5381A104B500; Tue, 9 Apr 2024 06:37:48 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 188812026D06; Tue, 9 Apr 2024 06:37:47 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 4396bggW1298850 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 9 Apr 2024 08:37:42 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 4396bgbK1298849; Tue, 9 Apr 2024 08:37:42 +0200 Date: Tue, 9 Apr 2024 08:37:41 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] bitint: Don't move debug stmts from before returns_twice calls [PR114628] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Hi! 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. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 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. Jakub --- gcc/gimple-lower-bitint.cc.jj 2024-04-04 10:46:52.698026863 +0200 +++ gcc/gimple-lower-bitint.cc 2024-04-08 15:42:19.719892644 +0200 @@ -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; --- gcc/testsuite/gcc.dg/bitint-105.c.jj 2024-04-08 16:00:07.843630530 +0200 +++ gcc/testsuite/gcc.dg/bitint-105.c 2024-04-08 15:49:28.687175492 +0200 @@ -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