]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-30.c
Fix profile update in tree_transform_and_unroll_loop
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-dse-30.c
1 /* PR tree-optimization/80933 - redundant bzero/bcopy calls not eliminated
2 { dg-do compile }
3 { dg-options "-O2 -fdump-tree-dse1" } */
4
5 void sink (void*);
6
7 void test_bcopy (const void *s)
8 {
9 char d[33];
10
11 /* Bcopy is transformed into memmove before DSE runs, so this test
12 doesn't actually verify that DSE does its job. */
13 __builtin_bcopy (s, d, sizeof d);
14 __builtin_bcopy (s, d, sizeof d);
15
16 sink (d);
17 }
18
19 void test_bzero (void)
20 {
21 char d[33];
22
23 __builtin_bzero (d, sizeof d);
24 __builtin_bzero (d, sizeof d);
25
26 sink (d);
27 }
28
29 /* { dg-final { scan-tree-dump-times "builtin_memset" 1 "dse1" } } */
30
31 /* Merging the evrp folder into substitute_and_fold_engine shuffled
32 the order of gimple_fold a bit, so evrp is no longer folding the
33 memmove inline. This folding is instead done by forwprop. Thus, I
34 have remmoved the |memmove in the test below as this is not done
35 until after dse.
36
37 What happened was that the propagator engine only called gimple
38 fold if replace_uses_in() was successful. On the other hand, EVRP
39 called gimple fold regardless.
40
41 If we really care about previous behavior, we could put a call to
42 gimple ::fold_stmt into evrp_folder::fold_stmt(). */
43 /* { dg-final { scan-tree-dump-not "builtin_(bcopy|bzero|memcpy)" "dse1" } } */