From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.lauterbach.com (smtp1.lauterbach.com [62.154.241.196]) by sourceware.org (Postfix) with ESMTPS id E960F3858CDB for ; Fri, 7 Oct 2022 15:11:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E960F3858CDB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lauterbach.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lauterbach.com Received: (qmail 3110 invoked by uid 484); 7 Oct 2022 15:11:22 -0000 X-Qmail-Scanner-Diagnostics: from 10.2.11.10 by smtp1.lauterbach.com (envelope-from , uid 484) with qmail-scanner-2.11 (mhr: 1.0. clamdscan: 0.99/21437. spamassassin: 3.4.0. Clear:RC:1(10.2.11.10):. Processed in 0.355333 secs); 07 Oct 2022 15:11:22 -0000 Received: from unknown (HELO [10.2.11.10]) (Authenticated_SSL:fsirl@[10.2.11.10]) (envelope-sender ) by smtp1.lauterbach.com (qmail-ldap-1.03) with TLS_AES_256_GCM_SHA384 encrypted SMTP for ; 7 Oct 2022 15:11:21 -0000 Message-ID: <858efa95-95be-7143-0c9e-cbc6673fa03c@lauterbach.com> Date: Fri, 7 Oct 2022 17:11:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [RFA] Minor improvement to coremark, avoid unconditional jump to return Content-Language: en-US To: Jeff Law , gcc-patches@gcc.gnu.org References: <76e49e22-86be-afbc-50d4-97e8c4d16be9@ventanamicro.com> From: Franz Sirl In-Reply-To: <76e49e22-86be-afbc-50d4-97e8c4d16be9@ventanamicro.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,BODY_8BITS,KAM_DMARC_STATUS,KAM_SHORT,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Am 2022-10-07 um 16:13 schrieb Jeff Law: > > On 10/7/22 04:51, Franz Sirl wrote: >> Am 2022-09-25 um 18:28 schrieb Jeff Law: >>> This is a minor improvement for the core_list_find routine in coremark. >>> >>> >>> Basically for riscv, and likely other targets, we can end up with an >>> unconditional jump to a return statement.    This is a result of >>> compensation code created by bb-reorder, and no jump optimization >>> pass runs after bb-reorder to clean this stuff up. >>> >>> This patch utilizes preexisting code to identify suitable branch >>> targets as well as preexisting code to emit a suitable return, so >>> it's pretty simple.  Note that when we arrange to do this >>> optimization, the original return block may become unreachable. So we >>> conditionally call delete_unreachable_blocks to fix that up. >>> >>> This triggers ~160 times during an x86_64 bootstrap.  Naturally it >>> bootstraps and regression tests on x86_64. >>> >>> I've also bootstrapped this on riscv64, regression testing with qemu >>> shows some regressions, but AFAICT they're actually qemu bugs with >>> signal handling/delivery -- qemu user mode emulation is not >>> consistently calling user defined signal handlers.  Given the same >>> binary, sometimes they'll get called and the test passes, other times >>> the handler isn't called and the test (of course) fails. I'll >>> probably spend some time to try and chase this down for the sake of >>> making testing easier. >>> >>> >>> OK for the trunk? >> >> Hello Jeff, >> >> I've bisected this change to break a "profiledbootstrap" on x86_64 >> like that: >> >> make[3]: Entering directory >> '/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/gcc' >> /home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/./prev-gcc/xg++ -B/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/./prev-gcc/ -B/usr/x86_64-suse-linux/ >> bin/ -nostdinc++ >> -B/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/prev-x86_64-suse-linux/libstdc++-v3/src/.libs -B/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64 >> -suse-linux/prev-x86_64-suse-linux/libstdc++-v3/libsupc++/.libs >> -I/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/prev-x86_64-suse-linux/libstdc++-v3/include/x86_64-suse-linu >> x >> -I/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/prev-x86_64-suse-linux/libstdc++-v3/include >> -I/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/libstdc++-v3/libsupc++ -L >> /home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/prev-x86_64-suse-linux/libstdc++-v3/src/.libs -L/home/fsirl/rpmbuild/BUILD/gcc-13.0.0+gitr13+2871/obj-x86_64-suse-linux/prev-x8 >> 6_64-suse-linux/libstdc++-v3/libsupc++/.libs  -fno-PIE -c   -O2 -g >> -fmessage-length=0 -D_FORTIFY_SOURCE=2 -funwind-tables >> -fasynchronous-unwind-tables -U_FORTIFY_SOURCE -fprofile-use >> -fprofile-reprod >> ucible=parallel-runs -DIN_GCC     -fno-exceptions -fno-rtti >> -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings >> -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic >> -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings >> -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. >> -I../../gcc/../include -I../../gcc/../libcpp/include >> -I../../gcc/../libcody >>  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid >> -I../libdecnumber -I../../gcc/../libbacktrace   -o cgraph.o -MT >> cgraph.o -MMD -MP -MF ./.deps/cgraph.TPo ../../gcc/cgraph.cc >> ../../gcc/cgraph.cc: In member function 'cgraph_edge* >> cgraph_edge::first_speculative_call_target()': >> ../../gcc/cgraph.cc:1166:1: error: EDGE_CROSSING incorrectly set >> across same section >>  1166 | } >>       | ^ >> ../../gcc/cgraph.cc:1166:1: error: No region crossing jump at section >> boundary in bb 19 >> during RTL pass: bbro >> ../../gcc/cgraph.cc:1166:1: internal compiler error: verify_flow_info >> failed >> 0xa7116e verify_flow_info() >>         ../../gcc/cfghooks.cc:284 >> 0x1c64958 execute >>         ../../gcc/bb-reorder.cc:2663 >> >> In such a case, what do you need to reproduce it? I'm a mere user of >> the Suse RPM builds here, no idea if profiling needs any extra data to >> reproduce to bug. > > Franz, it's been a long time.  Good to hear from you. > > > I'll take a look.  I'll start with a profiledbootstrap and if that > doesn't reproduce I'll get in contact Yes, long time... Things happened :-) But I'm still following GCC and report bugs as time permits. I've opened 107182 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107182 with the -freport-bug file and cgraph.gcda. I hope this is enough to reproduce. Franz.