This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH PR84969]Don't reorder builtin memsets if they set different rhs values
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Bin Cheng <Bin dot Cheng at arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Wed, 21 Mar 2018 10:28:04 +0100
- Subject: Re: [PATCH PR84969]Don't reorder builtin memsets if they set different rhs values
- References: <DB6PR0802MB2504475DBF9C4380CE47E0D9E7AB0@DB6PR0802MB2504.eurprd08.prod.outlook.com>
On Tue, Mar 20, 2018 at 7:18 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> As noted in PR84969, fuse_memset_builtins breaks dependence between different memsets.
> Specifically, it reorders different builtin memset partitions though it doesn't merge
> them in the end. This simple patch fixes this wrong code issue by checking if any two
> builtin memsets set the same rhs value or not. Note we don't need to bother if two
> memsets intersect with each other or not.
>
> Of course, this would miss opportunity merging S1/S3 in below case:
> memset(p+12, 0, 12); //<-----S1
> memset(p+17, 1, 10);
> memset(p, 0, 12); //<-----S3
> In my opinion, this should be resolved in a more general way maximizing parallelism
> as well as merging opportunities when sorting partitions into topological order from
> dependence graph, which isn't GCC8 task.
>
> Bootstrap and test on x86_64 and AArch64 ongoing. Okay if no failures?
OK.
Richard.
> Thanks,
> bin
>
> 2018-03-20 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/84969
> * tree-loop-distribution.c (fuse_memset_builtins): Don't reorder
> builtin memset partitions if they set differnt rhs values.
>
> gcc/testsuite
> 2018-03-20 Bin Cheng <bin.cheng@arm.com>
>
> PR tree-optimization/84969
> * gcc.dg/tree-ssa/pr84969.c: New test.
>