summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-30.c
blob: ece8cb2a80ca88ebe3fb3dfa79ea023048f2cb01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* PR tree-optimization/80933 - redundant bzero/bcopy calls not eliminated
   { dg-do compile }
   { dg-options "-O2 -fdump-tree-dse1" } */

void sink (void*);

void test_bcopy (const void *s)
{
  char d[33];

  /* Bcopy is transformed into memcpy and those calls are expanded
     inline in EVRP, before DSE runs, so this test doesn't actually
     verify that DSE does its job.  */
  __builtin_bcopy (s, d, sizeof d);
  __builtin_bcopy (s, d, sizeof d);

  sink (d);
}

void test_bzero (void)
{
  char d[33];

  __builtin_bzero (d, sizeof d);
  __builtin_bzero (d, sizeof d);

  sink (d);
}

/* { dg-final { scan-tree-dump-times "builtin_memset" 1 "dse1" } } */
/* { dg-final { scan-tree-dump-not "builtin_(bcopy|bzero|memcpy)" "dse1" } } */