This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] sched-deps: respect deps->readonly in macro-fusion (PR 84566)
- From: Andrey Belevantsev <abel at ispras dot ru>
- To: Alexander Monakov <amonakov at ispras dot ru>, gcc-patches at gcc dot gnu dot org
- Cc: "Vladimir N. Makarov" <vmakarov at redhat dot com>
- Date: Wed, 11 Apr 2018 13:19:23 +0300
- Subject: Re: [PATCH] sched-deps: respect deps->readonly in macro-fusion (PR 84566)
- Openpgp: preference=signencrypt
- References: <alpine.LNX.2.20.13.1804101323460.24851@monopod.intra.ispras.ru>
On 10.04.2018 13:40, Alexander Monakov wrote:
> Hi,
>
> this fixes a simple "regression" under the qsort_chk umbrella: sched-deps
> analysis has deps->readonly flag, but macro-fusion code does not respect it
> and mutates instructions. This breaks an assumption in sel_rank_for_schedule
> and manifests as qsort checking error.
>
> Since sched_macro_fuse_insns is only called to set SCHED_GROUP_P on suitable
> insns, guard the call with !deps->readonly.
>
> Bootstrapped/regtested on x86_64 with sel-sched active and
> --with-cpu=sandybridge to exercise macro-fusion code and verified on aarch64
> cross-compiler that the failing testcase given in the PR is fixed.
>
> OK to apply?
Fine with me but you need a scheduler maintainer approval.
Andrey
>
> Thanks.
> Alexander
>
> PR rtl-optimization/84566
> * sched-deps.c (sched_analyze_insn): Check deps->readonly when invoking
> sched_macro_fuse_insns.
>
> diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
> index 9a5cbebea40..120b5f0ddc1 100644
> --- a/gcc/sched-deps.c
> +++ b/gcc/sched-deps.c
> @@ -2897,7 +2897,8 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx_insn *insn)
> && code == SET);
>
> /* Group compare and branch insns for macro-fusion. */
> - if (targetm.sched.macro_fusion_p
> + if (!deps->readonly
> + && targetm.sched.macro_fusion_p
> && targetm.sched.macro_fusion_p ())
> sched_macro_fuse_insns (insn);
>
>