OSDN Git Service

2010-01-26 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp08.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details" } */
3
4 /* Compile with -fno-tree-fre -O2 to prevent CSEing *p.  */
5 foo (int a, int *p)
6 {
7   int x = *p + 2;
8   int y = *p - 1;
9   int z = *p + 9;
10
11   /* This should be folded to if (1), but only one ASSERT_EXPR should
12      be inserted.  */
13   if (p)
14     a = x + y + z;
15   else
16     a = x - y;
17
18   return a;
19 }
20 /* Target with fno-delete-null-pointer-checks should not fold checks */
21 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
22 /* { dg-final { scan-tree-dump-times "PREDICATE: p_.* ne_expr 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
23 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
24 /* { dg-final { cleanup-tree-dump "vrp1" } } */