From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 40FC63858D37 for ; Tue, 27 Sep 2022 01:09:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 40FC63858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-x330.google.com with SMTP id n40-20020a05600c3ba800b003b49aefc35fso4598451wms.5 for ; Mon, 26 Sep 2022 18:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=list-id:mime-version:subject:message-id:cc:to:date:from:from:to:cc :subject:date; bh=nPMnXwWiIvmOPvm0n2+HDZ6M+m2tYULN8+vikuoGN38=; b=kQn4Y6/cEJwsDO28UkOSCEEDPrAjgN8YbFQf7jRqHhj9nmRErK+FpVoEfKII/dp6tJ w0lOuqXqvxcLo4YJ6lsEel2TSLiXspNMqlQ3xHuz0KpZde5O0UyaIgf1r8iKKfzqdlyX wykNB+qHpbxzt3/JTmLPm7FdaoeJiUVETTsBZQNtLB5FUIvzzmNSuOCVfgHBNG0ylYDV wFPHeXLcBJEfL9SHpxoh++ZV4oskQ45C8JDFscytaQxvP8c2rB8S0Pmhg5RRzLet5x2f SBpaxvBWW9EHRfSOsMw0gXixgZx30jeCGLTgIQ4Pkhn5u0VeChLz121B8bXxw+yqAk41 fYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-id:mime-version:subject:message-id:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date; bh=nPMnXwWiIvmOPvm0n2+HDZ6M+m2tYULN8+vikuoGN38=; b=A80FLeTkjM8AROWWvgE95vR+g8xIhQUteB88GcATR44rxilsEkZNU1hmJIiQ5CCEi/ k8/Zcw48hll37x/eiFR1Q9WUNREq9GoYzeb7ENQclsoFbfKnpCKCR8CvtNoi3ZAMcFhL uke98E/LgBeo7d4ypZDirrLwWMMOG081KTGldPs9lAltVeAndXahSqB5fpHwgLKX7wu1 Y4vxdQyrCqYbksZ/cZUbpFMJ71d5lG4ctvbS9+E2VlKUIz2eixhiGJmW85J5howlA1Ci CF/ofSwGGx4C/0QcCWztB8Jr23gsYjz+19m19pP4DWYiWzcUXQEheOauuCqaIb/ghwKQ 3ahA== X-Gm-Message-State: ACrzQf3wtbZr6gb9VDxkYAtvd0OxF060rEPR2U0E7im7DP5jcv66kAdH bi1IEY41Fyn5hVQUmSQAvHgWOw== X-Google-Smtp-Source: AMsMyM4xA5woC4MwvG1luUBdVI8s6DNTpXek7OXeRzqB/5Hi7jMtA8RcI73QOxEvT3n1w8XPS1zDEw== X-Received: by 2002:a05:600c:3511:b0:3b4:bb85:f1e3 with SMTP id h17-20020a05600c351100b003b4bb85f1e3mr864749wmq.0.1664240954780; Mon, 26 Sep 2022 18:09:14 -0700 (PDT) Received: from jenkins.jenkins (ci.linaro.org. [88.99.136.175]) by smtp.gmail.com with ESMTPSA id o41-20020a05600c512900b003a5c244fc13sm12976295wms.2.2022.09.26.18.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 18:09:14 -0700 (PDT) From: ci_notify@linaro.org X-Google-Original-From: linaro-infrastructure-errors@lists.linaro.org Date: Tue, 27 Sep 2022 01:09:13 +0000 (UTC) To: Jeff Law Cc: gcc-regression@gcc.gnu.org Message-ID: <1266461470.2957.1664240954226@jenkins.jenkins> Subject: [TCWG CI] Failure after basepoints/gcc-13-2871-g1b74b5cb4e9: [RFA] Minor improvement to coremark, avoid unconditional jump to return MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2956_945998681.1664240953637" X-Jenkins-Job: TCWG Build tcwg_gnu_cross_build/master-arm X-Jenkins-Result: SUCCESS List-ID: X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 ------=_Part_2956_945998681.1664240953637 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Failure after basepoints/gcc-13-2871-g1b74b5cb4e9: [RFA] Minor improvement = to coremark, avoid unconditional jump to return: Results changed to -10 # true: 0 # build_abe binutils: 1 # build_abe stage1: # FAILED # First few build errors in logs: # 00:09:33 cc1: error: no include path in which to search for stdc-predef.h # 00:10:01 /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gcc.git= ~master/libgcc/fixed-bit.c:246:1: internal compiler error: in target_gen_si= mple_return, at /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gc= c.git~master/gcc/config/arm/arm.md:8998 # 00:10:01 /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gcc.git= ~master/libgcc/fixed-bit.c:246:1: internal compiler error: in target_gen_si= mple_return, at /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gc= c.git~master/gcc/config/arm/arm.md:8998 # 00:10:01 make[2]: *** [/home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/sna= pshots/gcc.git~master/libgcc/fixed-obj.mk:27: _saturate2DA.o] Error 1 # 00:10:01 make[2]: *** [/home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/sna= pshots/gcc.git~master/libgcc/fixed-obj.mk:27: _saturate2DQ.o] Error 1 # 00:10:02 make[1]: *** [Makefile:12767: all-target-libgcc] Error 2 # 00:10:03 make: *** [Makefile:1004: all] Error 2 from -10 # true: 0 # build_abe binutils: 1 # build_abe stage1: 2 # build_abe linux: 3 # build_abe glibc: 4 # build_abe stage2: 5 # build_abe gdb: 6 # build_abe qemu: 7 THIS IS THE END OF INTERESTING STUFF. BELOW ARE LINKS TO BUILDS, REPRODUCT= ION INSTRUCTIONS, AND THE RAW COMMIT. For latest status see comments in https://linaro.atlassian.net/browse/GNU-6= 92 . Status of basepoints/gcc-13-2871-g1b74b5cb4e9 commit for tcwg_gnu_cross_bui= ld: commit 1b74b5cb4e9d7191f298245063a8f9c3a1bbeff4 Author: Jeff Law Date: Sun Sep 25 12:23:59 2022 -0400 [RFA] Minor improvement to coremark, avoid unconditional jump to return =20 gcc/ * cfgcleanup.cc (bb_is_just_return): No longer static. * cfgcleanup.h (bb_is_just_return): Add prototype. * cfgrtl.cc (fixup_reorder_chain): Do not create an unconditional jump to a return block. Conditionally remove unreachable blocks. =20 gcc/testsuite/ =20 * gcc.target/riscv/ret-1.c: New test. * master-arm ** Failure after basepoints/gcc-13-2871-g1b74b5cb4e9: [RFA] Minor improveme= nt to coremark, avoid unconditional jump to return: ** https://ci.linaro.org/job/tcwg_gnu_cross_build-build-master-arm/1653/ Bad build: https://ci.linaro.org/job/tcwg_gnu_cross_build-build-master-arm= /1653/artifact/artifacts Good build: https://ci.linaro.org/job/tcwg_gnu_cross_build-build-master-arm= /1652/artifact/artifacts Reproduce current build: mkdir -p investigate-gcc-1b74b5cb4e9d7191f298245063a8f9c3a1bbeff4 cd investigate-gcc-1b74b5cb4e9d7191f298245063a8f9c3a1bbeff4 # Fetch scripts git clone https://git.linaro.org/toolchain/jenkins-scripts # Fetch manifests for bad and good builds mkdir -p bad/artifacts good/artifacts curl -o bad/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gnu_cross_= build-build-master-arm/1653/artifact/artifacts/manifest.sh --fail curl -o good/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gnu_cross= _build-build-master-arm/1652/artifact/artifacts/manifest.sh --fail # Reproduce bad build (cd bad; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] a= rtifacts) # Reproduce good build (cd good; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] = artifacts) Full commit (up to 1000 lines): commit 1b74b5cb4e9d7191f298245063a8f9c3a1bbeff4 Author: Jeff Law Date: Sun Sep 25 12:23:59 2022 -0400 [RFA] Minor improvement to coremark, avoid unconditional jump to return =20 gcc/ * cfgcleanup.cc (bb_is_just_return): No longer static. * cfgcleanup.h (bb_is_just_return): Add prototype. * cfgrtl.cc (fixup_reorder_chain): Do not create an unconditional jump to a return block. Conditionally remove unreachable blocks. =20 gcc/testsuite/ =20 * gcc.target/riscv/ret-1.c: New test. --- gcc/cfgcleanup.cc | 2 +- gcc/cfgcleanup.h | 1 + gcc/cfgrtl.cc | 29 +++++++++++++++++++++++- gcc/testsuite/gcc.target/riscv/ret-1.c | 41 ++++++++++++++++++++++++++++++= ++++ 4 files changed, 71 insertions(+), 2 deletions(-) diff --git a/gcc/cfgcleanup.cc b/gcc/cfgcleanup.cc index a8b0139bb4d..a363e0b4da3 100644 --- a/gcc/cfgcleanup.cc +++ b/gcc/cfgcleanup.cc @@ -2599,7 +2599,7 @@ trivially_empty_bb_p (basic_block bb) return value. Fill in *RET and *USE with the return and use insns if any found, otherwise NULL. All CLOBBERs are ignored. */ =20 -static bool +bool bb_is_just_return (basic_block bb, rtx_insn **ret, rtx_insn **use) { *ret =3D *use =3D NULL; diff --git a/gcc/cfgcleanup.h b/gcc/cfgcleanup.h index a6d882f98a4..f1021ca835f 100644 --- a/gcc/cfgcleanup.h +++ b/gcc/cfgcleanup.h @@ -30,5 +30,6 @@ extern int flow_find_head_matching_sequence (basic_block,= basic_block, extern bool delete_unreachable_blocks (void); extern void delete_dead_jumptables (void); extern bool cleanup_cfg (int); +extern bool bb_is_just_return (basic_block, rtx_insn **, rtx_insn **); =20 #endif /* GCC_CFGCLEANUP_H */ diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc index a05c338a4c8..90cd6ee56a7 100644 --- a/gcc/cfgrtl.cc +++ b/gcc/cfgrtl.cc @@ -3901,6 +3901,7 @@ fixup_reorder_chain (void) /* Now add jumps and labels as needed to match the blocks new outgoing edges. */ =20 + bool remove_unreachable_blocks =3D false; for (bb =3D ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; bb ; bb =3D (basic_b= lock) bb->aux) { @@ -4043,10 +4044,30 @@ fixup_reorder_chain (void) =09 continue; =09} =20 + /* If E_FALL->dest is just a return block, then we can emit a +=09 return rather than a jump to the return block. */ + rtx_insn *ret, *use; + basic_block dest; + if (bb_is_just_return (e_fall->dest, &ret, &use) +=09 && (PATTERN (ret) =3D=3D simple_return_rtx || PATTERN (ret) =3D=3D re= t_rtx)) +=09{ +=09 ret_label =3D PATTERN (ret); +=09 dest =3D EXIT_BLOCK_PTR_FOR_FN (cfun); + +=09 /* E_FALL->dest might become unreachable as a result of +=09 replacing the jump with a return. So arrange to remove +=09 unreachable blocks. */ +=09 remove_unreachable_blocks =3D true; +=09} + else +=09{ +=09 dest =3D e_fall->dest; +=09} + /* We got here if we need to add a new jump insn.=20 =09 Note force_nonfallthru can delete E_FALL and thus we have to =09 save E_FALL->src prior to the call to force_nonfallthru. */ - nb =3D force_nonfallthru_and_redirect (e_fall, e_fall->dest, ret_lab= el); + nb =3D force_nonfallthru_and_redirect (e_fall, dest, ret_label); if (nb) =09{ =09 nb->aux =3D bb->aux; @@ -4134,6 +4155,12 @@ fixup_reorder_chain (void) =09=09 ei_next (&ei2); =09 } } + + /* Replacing a jump with a return may have exposed an unreachable + block. Conditionally remove them if such transformations were + made. */ + if (remove_unreachable_blocks) + delete_unreachable_blocks (); } =0C /* Perform sanity checks on the insn chain. diff --git a/gcc/testsuite/gcc.target/riscv/ret-1.c b/gcc/testsuite/gcc.tar= get/riscv/ret-1.c new file mode 100644 index 00000000000..28133aa4226 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/ret-1.c @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -dp" } */ +/* This was extracted from coremark. */ + + +typedef signed short ee_s16; +typedef struct list_data_s +{ + ee_s16 data16; + ee_s16 idx; +} list_data; + +typedef struct list_head_s +{ + struct list_head_s *next; + struct list_data_s *info; +} list_head; + + +list_head * +core_list_find(list_head *list, list_data *info) +{ + if (info->idx >=3D 0) + { + while (list && (list->info->idx !=3D info->idx)) + list =3D list->next; + return list; + } + else + { + while (list && ((list->info->data16 & 0xff) !=3D info->data16)) + list =3D list->next; + return list; + } +} + +/* There is only one legitimate unconditional jump, so test for that, + which will catch the case where bb-reorder leaves a jump to a ret + in the IL. */ +/* { dg-final { scan-assembler-times "jump" 1 } } */ + ------=_Part_2956_945998681.1664240953637--