diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c new file mode 100644 index 000000000..5acf083c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fre" } */ + +struct S { unsigned f; }; + +int +foo ( struct S *p) +{ + int *q = (int *)&p->f; + int i = *q; + return i + p->f; +} + + +/* There should only be one load of p->f because fwprop can change + *(int *)&p->f into just (int)p->f. */ +/* { dg-final { scan-tree-dump-times "= \[^\n\]*p_.\\\(D\\\)" 1 "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ + |