From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id D47DB3858CDA for ; Mon, 26 Sep 2022 20:53:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D47DB3858CDA 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-wr1-x42c.google.com with SMTP id y5so12062937wrh.3 for ; Mon, 26 Sep 2022 13:53:57 -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=3CTXwjp4NzpqoA57Lm88HR+p6+mO8RVLZlDANGjRQcY=; b=vYe+Dp45xaTF2+gtIZhJgG2D7HKkrFuGMo+055AE0ZK1sRyRVMYbdA72mkrtG+HyR5 KVAqDLkXmBw1aanN83oFtXbHd8NmlNIz34E9mKmbKE/odWLUe1mUdGNL+/VtA19bC/Ne MeeVG6Xj1g6r450RqaOmntalklY50Sy75XiHMVQsj21NIuU4WP1fb5miXJOVo+eDUWiH lsPQHdoBlPAlTGV9PY5Owpc4glxnReDEw+hn9JRDbH8yAWOMhdDtniQuKKCoxgNZP4h7 rqg9jw6LpOmH2T8A2jlA0GzZyU1XJWbWZb+MOQ8+RESqy5kdk7+lyH/TtEu2JyEkcaet cXOQ== 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=3CTXwjp4NzpqoA57Lm88HR+p6+mO8RVLZlDANGjRQcY=; b=lVSyE3cOi8K9OmaWBRVTyFysc5KWLgdVvYkyltlMuBVI54EA+MSJdQsTP8qis+aY1u J3CQ7K93v6YL5Gqo4AHDW6A3e3cKN/LxToWfv31aqbSf2jKDUPsbcLhzMdEq6Y5t1ufG xk6JeNotuEzG9PFzXC4Ldaua7mGCb30EM04IBeQF9mx7k8sOweEMlZR+i5Dymher7MqL uIqp1zeUyCs+hHVv2Mqg9vC4EGlxFYZjEUYPnqj1EahCn2jNwXt+N+yG9c2cE8Lr/WOd 1RLjh4wx7fZbY5UbDv/VdlG2MX6NOAyytRDB/j+04mwKT8wLc3106SdOLAIm1mVhLC1E P/gg== X-Gm-Message-State: ACrzQf2xfhgEfs0tLrQAyXFPVfmoWdSCi12x3JoC6N4CFBckVUoWbN/z OKJPbHnZI1QcnPZ0BhCzF1bwig== X-Google-Smtp-Source: AMsMyM6bDaqebEDDH6Jok9l/dMBu9RE/MTDF2P9V9WMkhwuZR7Z6xT919DH/j/GwRqHuwJN6SxRN3w== X-Received: by 2002:a5d:648c:0:b0:22a:2c04:97a5 with SMTP id o12-20020a5d648c000000b0022a2c0497a5mr14770670wri.326.1664225636564; Mon, 26 Sep 2022 13:53:56 -0700 (PDT) Received: from jenkins.jenkins (ci.linaro.org. [88.99.136.175]) by smtp.gmail.com with ESMTPSA id w9-20020adfd4c9000000b00228d67db06esm15448652wrk.21.2022.09.26.13.53.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 13:53:55 -0700 (PDT) From: ci_notify@linaro.org X-Google-Original-From: linaro-infrastructure-errors@lists.linaro.org Date: Mon, 26 Sep 2022 20:53:54 +0000 (UTC) To: Jeff Law Cc: gcc-regression@gcc.gnu.org Message-ID: <242307570.2806.1664225635961@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_2805_4328875.1664225635197" X-Jenkins-Job: TCWG Build tcwg_gcc_bootstrap/master-arm-bootstrap 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_2805_4328875.1664225635197 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 bootstrap: # FAILED # First few build errors in logs: # 00:04:19 /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/snapshots/gcc.git= ~master/libgomp/env.c:1964:1: internal compiler error: in target_gen_simple= _return, at /home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/snapshots/gcc.gi= t~master/gcc/config/arm/arm.md:8998 # 00:04:19 make[5]: *** [Makefile:801: env.lo] Error 1 # 00:04:41 make[4]: *** [Makefile:1024: all-recursive] Error 1 # 00:04:41 make[3]: *** [Makefile:624: all] Error 2 # 00:04:41 make[2]: *** [Makefile:23499: all-stage1-target-libgomp] Error 2 # 00:05:29 make[3]: [Makefile:1788: armv8l-unknown-linux-gnueabihf/bits/lar= gefile-config.h] Error 1 (ignored) # 00:05:29 make[1]: *** [Makefile:25433: stage1-bubble] Error 2 # 00:05:29 make: *** [Makefile:1064: all] Error 2 from -10 # true: 0 # build_abe binutils: 1 # build_abe bootstrap: 2 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_gcc_bootstrap= : 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-bootstrap ** Failure after basepoints/gcc-13-2871-g1b74b5cb4e9: [RFA] Minor improveme= nt to coremark, avoid unconditional jump to return: ** https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-arm-bootstrap/= 1541/ Bad build: https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-arm-b= ootstrap/1541/artifact/artifacts Good build: https://ci.linaro.org/job/tcwg_gcc_bootstrap-build-master-arm-b= ootstrap/1540/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_gcc_bootst= rap-build-master-arm-bootstrap/1541/artifact/artifacts/manifest.sh --fail curl -o good/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gcc_boots= trap-build-master-arm-bootstrap/1540/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_2805_4328875.1664225635197--