annotate gcc/testsuite/gcc.dg/tree-ssa/alias-29.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-O -fdump-tree-optimized" } */
kono
parents:
diff changeset
3 /* { dg-add-options bind_pic_locally } */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 union X {
kono
parents:
diff changeset
6 int i;
kono
parents:
diff changeset
7 void *p;
kono
parents:
diff changeset
8 };
kono
parents:
diff changeset
9 void bar (int);
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 int * __attribute__((noinline,noclone))
kono
parents:
diff changeset
12 baz (int *p) { return p; }
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 void foo (union X *x)
kono
parents:
diff changeset
15 {
kono
parents:
diff changeset
16 struct Y { int i; } ystruct = {};
kono
parents:
diff changeset
17 ystruct.i = * baz (&ystruct.i);
kono
parents:
diff changeset
18 bar (x->i);
kono
parents:
diff changeset
19 }
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 /* DSE and then DCE should be able to remove all uses of ystruct.
kono
parents:
diff changeset
22 Formerly the union access for the parameter to bar let 'anything'
kono
parents:
diff changeset
23 escape which made the call to bar possibly use ystruct and thus
kono
parents:
diff changeset
24 prevent the store to ystruct.i from being eliminated. The call to
kono
parents:
diff changeset
25 baz makes sure that ystruct has its address taken. */
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 /* { dg-final { scan-tree-dump-not "ystruct" "optimized" } } */