libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-fre-99.c
blob101d0d63f7a13cd775b9356939390806512de1fe
1 /* { dg-do compile } */
2 /* Disable FRE1 because that for the sake of __builtin_object_size
3 will not consider the equality but still valueize 'i', defeating
4 the purpose of the check. */
5 /* { dg-options "-O -fdump-tree-fre3 -fdisable-tree-fre1" } */
7 struct S { int a[4]; };
9 int i;
10 int bar (struct S *p)
12 char *q = (char *)p + 4;
13 i = 1;
14 int *r = &((struct S *)p)->a[i];
15 return q == (char *)r;
17 int baz (struct S *p)
19 i = 1;
20 int *r = &((struct S *)p)->a[i];
21 char *q = (char *)p + 4;
22 return q == (char *)r;
25 /* Verify FRE can handle valueizing &p->a[i] and value-numbering it
26 equal to a POINTER_PLUS_EXPR. */
27 /* { dg-final { scan-tree-dump-times "return 1;" 2 "fre3" } } */