diff options
author | Bin Cheng <bin.cheng@arm.com> | 2018-03-21 10:42:34 +0000 |
---|---|---|
committer | Bin Cheng <amker@gcc.gnu.org> | 2018-03-21 10:42:34 +0000 |
commit | 49e4ca31396d129759ac1bfc2ffbd3f87aeb53cb (patch) | |
tree | f27f80a9a5e6fa1d78efcd4d2f2ecd95c36d9667 /gcc/tree-loop-distribution.c | |
parent | 108b83c1fd97b06f1e99ffb5127f2c5b9623bb11 (diff) | |
download | gcc-49e4ca31396d129759ac1bfc2ffbd3f87aeb53cb.zip gcc-49e4ca31396d129759ac1bfc2ffbd3f87aeb53cb.tar.gz gcc-49e4ca31396d129759ac1bfc2ffbd3f87aeb53cb.tar.bz2 |
re PR tree-optimization/84969 (Wrong code with -ftree-loop-distribute-patterns)
PR tree-optimization/84969
* tree-loop-distribution.c (fuse_memset_builtins): Don't reorder
builtin memset partitions if they set different rhs values.
gcc/testsuite
* gcc.dg/tree-ssa/pr84969.c: New test.
From-SVN: r258710
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r-- | gcc/tree-loop-distribution.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 67f27ba..5e327f4 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -2569,6 +2569,7 @@ fuse_memset_builtins (vec<struct partition *> *partitions) { unsigned i, j; struct partition *part1, *part2; + tree rhs1, rhs2; for (i = 0; partitions->iterate (i, &part1);) { @@ -2586,6 +2587,12 @@ fuse_memset_builtins (vec<struct partition *> *partitions) || !operand_equal_p (part1->builtin->dst_base_base, part2->builtin->dst_base_base, 0)) break; + + /* Memset calls setting different values can't be merged. */ + rhs1 = gimple_assign_rhs1 (DR_STMT (part1->builtin->dst_dr)); + rhs2 = gimple_assign_rhs1 (DR_STMT (part2->builtin->dst_dr)); + if (!operand_equal_p (rhs1, rhs2, 0)) + break; } /* Stable sort is required in order to avoid breaking dependence. */ @@ -2617,8 +2624,8 @@ fuse_memset_builtins (vec<struct partition *> *partitions) i++; continue; } - tree rhs1 = gimple_assign_rhs1 (DR_STMT (part1->builtin->dst_dr)); - tree rhs2 = gimple_assign_rhs1 (DR_STMT (part2->builtin->dst_dr)); + rhs1 = gimple_assign_rhs1 (DR_STMT (part1->builtin->dst_dr)); + rhs2 = gimple_assign_rhs1 (DR_STMT (part2->builtin->dst_dr)); int bytev1 = const_with_all_bytes_same (rhs1); int bytev2 = const_with_all_bytes_same (rhs2); /* Only merge memset partitions of the same value. */ |