From patchwork Wed Oct 30 07:31:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 2004029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=N+ibwu+o; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xdf2j5CWVz1xwK for ; Wed, 30 Oct 2024 18:31:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D33E385828E for ; Wed, 30 Oct 2024 07:31:53 +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.133.124]) by sourceware.org (Postfix) with ESMTP id D2AD43858D28 for ; Wed, 30 Oct 2024 07:31:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D2AD43858D28 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 D2AD43858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730273491; cv=none; b=QSBszivW8n3KKuCOXVUh8e8FcIeCB/0RhCfdtc65jim0GVoi1aPsg+JaPHtN7TcchF9PxB22c91U9GFV6SMXFWVnTSHPUKFQqYCcUjYYOUk9MUn8Xh+fFNn74zvGDbT7BsfVBOVSOQVp6IFPt9noLfjqgVseHPE5RTPlDaa9dYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730273491; c=relaxed/simple; bh=KT6QOVemHX/I8ZZzjuTrhCVZFJEmOJ0ACbEQGBzxKho=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=eryeO6TO/RLftyPPlL7e/Xe3+i5M0F2xFwNGdtuPhNi4whPzu2Qzuf8S6SfVVL0989iId8w2NXWw0hB/QvUj5JEiGiWUpeIKk74vhEju2c6FbuqhWXT4CQYHLYrnOHziHCqfQ6yeEmy3HyK5Qni+CwOGktGUf2UgtlX9mVfRtpk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730273480; 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=4qYdDtGbFue1oD37JyB2y74lSKLT0jVAAVDwZus+l3g=; b=N+ibwu+oNPVhEucxMlO+ZwNu3eHtZc8SukTVY4zQ5T55jtwe3OOAMw1F+/bYRcYBKPieoM pAsk3TNsN4U88T336OHCfrCf1qU04/M/sGm9I4oXPNtv7O/oua9ztNZc8YvC9W9cPRTE2R rDyvj9qymTT60xG0/9XzKbhG02qV0T0= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-466-9S3pSrDxMQeMnrQJCUDWMQ-1; Wed, 30 Oct 2024 03:31:16 -0400 X-MC-Unique: 9S3pSrDxMQeMnrQJCUDWMQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 982D41955E7A; Wed, 30 Oct 2024 07:31:14 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1FD2119560A7; Wed, 30 Oct 2024 07:31:13 +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 49U7VAIZ1784785 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 30 Oct 2024 08:31:11 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 49U7VAOo1784784; Wed, 30 Oct 2024 08:31:10 +0100 Date: Wed, 30 Oct 2024 08:31:09 +0100 From: Jakub Jelinek To: Richard Biener , Jeff Law , Eric Botcazou Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] function: Call do_pending_stack_adjust in assign_parms [PR117296] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! Functions called by assign_parms call emit_block_move in two places, so on some targets can be expanded as calls and can result in pending stack adjustment. Now, during expansion we normally call do_pending_stack_adjust at the end of expansion of each basic block or before emitting code that will branch and/or has labels, and when emitting labels we assert that there are no pending stack adjustments. assign_parms is expanded before the first basic block and if the first basic block starts with a label and at least one of those emit_block_move calls resulted in the need of pending stack adjustments, we ICE when emitting that label. THe following patch fixes that by calling do_pending_stack_adjust after after the assign_parms potential emit_block_move calls. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-10-30 Jakub Jelinek PR target/117296 * function.cc (assign_parms): Call do_pending_stack_adjust. * gcc.target/i386/pr117296.c: New test. Jakub --- gcc/function.cc.jj 2024-10-25 10:00:29.457768014 +0200 +++ gcc/function.cc 2024-10-29 17:58:46.221000567 +0100 @@ -3747,6 +3747,8 @@ assign_parms (tree fndecl) now that all parameters have been copied out of hard registers. */ emit_insn (all.first_conversion_insn); + do_pending_stack_adjust (); + /* Estimate reload stack alignment from scalar return mode. */ if (SUPPORTS_STACK_ALIGNMENT) { --- gcc/testsuite/gcc.target/i386/pr117296.c.jj 2024-10-29 18:00:51.424261306 +0100 +++ gcc/testsuite/gcc.target/i386/pr117296.c 2024-10-29 18:01:45.434511045 +0100 @@ -0,0 +1,12 @@ +/* PR target/117296 */ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-additional-options "-mtune=k6 -mstringop-strategy=libcall -ffloat-store" { target ia32 } } */ + +int x; + +void +foo (_Complex double c) +{ + lab:; +}