From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id F09B03858407 for ; Thu, 9 Dec 2021 15:21:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F09B03858407 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DFC2C210FF; Thu, 9 Dec 2021 15:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1639063267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fkqt9i7lhSgamUPuDsI+c4XXgKoq3sLEyqZvyP707Xc=; b=JgIeLpZ9YjRlFf0Hdiw/B9FxGcqUCwKa0W2D97QtoyBGmw4BbCZz6g7O4gLNp9MF/5MYkw Yw5jzeWq4rCzepK1epmQ7Ez/Z3O1w4Fo5lzS6v8FR3yqPkYwlDs4P6Khs7meWFvc4StN+5 sQpC9S52olXiW9xlIk6gWOfi+RV3vnI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1639063267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fkqt9i7lhSgamUPuDsI+c4XXgKoq3sLEyqZvyP707Xc=; b=ZwSLa3bdsuOVsHBymlFxE49cZAcfE838Ji/9PwHPBOe/4uWhQfwzqes1EP3XCk+809/2cD 21Y3J0jr32UxdUCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B73F713343; Thu, 9 Dec 2021 15:21:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id enl9K+MesmGDQQAAMHmgww (envelope-from ); Thu, 09 Dec 2021 15:21:07 +0000 Message-ID: Date: Thu, 9 Dec 2021 16:21:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: Re: [PATCH] pragma: Update target option node when optimization changes [PR103515] To: "Kewen.Lin" , GCC Patches Cc: Richard Biener , Segher Boessenkool , Bill Schmidt , bergner@linux.ibm.com References: <6e9eaac5-3154-6460-1327-5c6afc14e33a@linux.ibm.com> Content-Language: en-US In-Reply-To: <6e9eaac5-3154-6460-1327-5c6afc14e33a@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 15:21:10 -0000 On 12/7/21 03:15, Kewen.Lin wrote: > Hi, > > For a function with optimize pragma, it's possible that the target > options change as optimization options change. Now we create one > optimization option node when parsing pragma optimize, but don't > create target option node for possible target option changes. It > makes later processing not detect the target options have actually > changed and doesn't update the target options accordingly. > > This patch is to check whether target options have changed when > creating one optimization option node for pragma optimize, and > make one target option node if needed. The associated test case > shows the difference. Without this patch, the function foo1 will > perform unrolling which is unexpected. The reason is that flag > unroll_only_small_loops isn't correctly set for it. The value > is updated after parsing function foo2, but doesn't get restored > later since both decls don't have DECL_FUNCTION_SPECIFIC_TARGET > set and the hook think we don't need to switch. With this patch, > there is no unrolling for foo1, which is also consistent with the > behavior by replacing pragma by attribute whether w/ and w/o this > patch. > > Bootstrapped and regtested on x86_64-redhat-linux, aarch64-linux-gnu > and powerpc64{,le}-linux-gnu. > > Is it ok for trunk? > > BR, > Kewen > --- > gcc/ChangeLog: > > PR target/103515 > * attribs.c (decl_attributes): Check if target options change and > create one node if so. > > gcc/testsuite/ChangeLog: > > PR target/103515 > * gcc.target/powerpc/pr103515.c: New test. > > ----- > Hello. I do support the patch as it does pretty similar thing to what I did in g:ebd5e86c0f41dc1d692f9b2b68a510b1f6835a3e. The revision was about pragmas. I can confirm the patch can bootstrap on x86_64-linux-gnu and survives regression tests. Martin