Successfully identified regression in *gcc* in CI configuration tcwg_bmk_llvm_tk1/llvm-master-arm-spec2k6-O2_LTO. So far, this commit has regressed CI configurations: - tcwg_bmk_llvm_tk1/llvm-master-arm-spec2k6-O2_LTO
Culprit: <cut> commit a310bb73edc9548e08d1fa28e7a56246caf27757 Author: Richard Biener rguenther@suse.de Date: Tue May 4 10:07:35 2021 +0200
tree-optimization/100329 - avoid reassociating asm goto defs
This avoids reassociating asm goto defs because we have no idea on which outgoing edge to insert defs.
2021-05-04 Richard Biener rguenther@suse.de
PR tree-optimization/100329 * tree-ssa-reassoc.c (can_reassociate_p): Do not reassociate asm goto defs. (insert_stmt_after): Assert we're not running into asm goto.
* gcc.dg/torture/pr100329.c: New testcase. </cut>
Results regressed to (for first_bad == a310bb73edc9548e08d1fa28e7a56246caf27757) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -O2_LTO_marm -- artifacts/build-a310bb73edc9548e08d1fa28e7a56246caf27757/results_id: 1 # 471.omnetpp,omnetpp_base.default regressed by 103
from (for last_good == 2326627eb19d8c21251fd60479f1a190621c475b) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--with-mode=arm --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -O2_LTO_marm -- artifacts/build-2326627eb19d8c21251fd60479f1a190621c475b/results_id: 1
Artifacts of last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a... Results ID of last_good: tk1_32/tcwg_bmk_llvm_tk1/bisect-llvm-master-arm-spec2k6-O2_LTO/1063 Artifacts of first_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a... Results ID of first_bad: tk1_32/tcwg_bmk_llvm_tk1/bisect-llvm-master-arm-spec2k6-O2_LTO/1045 Build top page/logs: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a...
Configuration details:
Reproduce builds: <cut> mkdir investigate-gcc-a310bb73edc9548e08d1fa28e7a56246caf27757 cd investigate-gcc-a310bb73edc9548e08d1fa28e7a56246caf27757
git clone https://git.linaro.org/toolchain/jenkins-scripts
mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a... --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a... --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a... --fail chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
cd gcc
# Reproduce first_bad build git checkout --detach a310bb73edc9548e08d1fa28e7a56246caf27757 ../artifacts/test.sh
# Reproduce last_good build git checkout --detach 2326627eb19d8c21251fd60479f1a190621c475b ../artifacts/test.sh
cd .. </cut>
History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/c...
Artifacts: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a... Build log: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tk1-llvm-master-a...
Full commit (up to 1000 lines): <cut> commit a310bb73edc9548e08d1fa28e7a56246caf27757 Author: Richard Biener rguenther@suse.de Date: Tue May 4 10:07:35 2021 +0200
tree-optimization/100329 - avoid reassociating asm goto defs
This avoids reassociating asm goto defs because we have no idea on which outgoing edge to insert defs.
2021-05-04 Richard Biener rguenther@suse.de
PR tree-optimization/100329 * tree-ssa-reassoc.c (can_reassociate_p): Do not reassociate asm goto defs. (insert_stmt_after): Assert we're not running into asm goto.
* gcc.dg/torture/pr100329.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr100329.c | 16 ++++++++++++++++ gcc/tree-ssa-reassoc.c | 10 ++++++++++ 2 files changed, 26 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/torture/pr100329.c b/gcc/testsuite/gcc.dg/torture/pr100329.c new file mode 100644 index 00000000000..b90700dd5f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100329.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options "--param tree-reassoc-width=2" } */ + +unsigned int a0; + +unsigned int +foo (unsigned int a1, unsigned int a2) +{ + unsigned int x; + + asm goto ("" : "=r" (x) : : : lab); + a0 = x; + + lab: + return x + a1 + a2 + 1; +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 8e2a4896d14..359367c9382 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1446,6 +1446,10 @@ insert_stmt_after (gimple *stmt, gimple *insert_point) gsi_insert_after (&gsi, stmt, GSI_NEW_STMT); return; } + else if (gimple_code (insert_point) == GIMPLE_ASM) + /* We have no idea where to insert - it depends on where the + uses will be placed. */ + gcc_unreachable (); else /* We assume INSERT_POINT is a SSA_NAME_DEF_STMT of some SSA_NAME, thus if it must end a basic block, it should be a call that can @@ -5893,6 +5897,12 @@ can_reassociate_p (tree op) tree type = TREE_TYPE (op); if (TREE_CODE (op) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op)) return false; + /* Make sure asm goto outputs do not participate in reassociation since + we have no way to find an insertion place after asm goto. */ + if (TREE_CODE (op) == SSA_NAME + && gimple_code (SSA_NAME_DEF_STMT (op)) == GIMPLE_ASM + && gimple_asm_nlabels (as_a <gasm *> (SSA_NAME_DEF_STMT (op))) != 0) + return false; if ((ANY_INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type)) || NON_SAT_FIXED_POINT_TYPE_P (type) || (flag_associative_math && FLOAT_TYPE_P (type))) </cut>