On 03/20/2018 07:18 PM, Bin Cheng 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?

Thanks,
bin

2018-03-20  Bin Cheng  <bin.ch...@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.ch...@arm.com>

        PR tree-optimization/84969
        * gcc.dg/tree-ssa/pr84969.c: New test.


Thanks Bin.

I can confirm it fixes regression tests of postgres w/ -O3.

Martin

Reply via email to