diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/vrp67.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/vrp67.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp67.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp67.c new file mode 100644 index 00000000000..f02d83780a6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp67.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +unsigned foo (unsigned i) +{ + if (i == 2) + { + i = i << 2; + if (i != 8) + link_error (); + } + return i; +} +unsigned bar (unsigned i) +{ + if (i == 1 << (sizeof (unsigned) * 8 - 1)) + { + i = i << 1; + if (i != 0) + link_error (); + } + return i; +} +unsigned baz (unsigned i) +{ + i = i & 15; + if (i == 0) + return 0; + i = 1000 - i; + i >>= 1; + i <<= 1; + if (i == 0) + link_error (); + return i; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 3 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ |