diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c new file mode 100644 index 00000000000..c699bc6ac80 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */ + + +int bar (void); + +int foo () +{ + int a = -100; + + /* This exercises a code with two loop nests. */ + + /* loop_1 runs 100 times. */ + while (a < 0) + a++; + + a -= 77; + + /* loop_2 runs 26 times. */ + while (a < 0) + a+=3; +} + +/* The analyzer sees two loop nests: + for the first, it determines the evolution: + a -> {-100, +, 1}_1 + + and for the second, it determines that the first loop ends at 0 and then: + a -> {-77, +, 3}_2 + + When the constant propagation is postponed, the analyzer detects + for the second loop the evolution function: + a -> {a_5, +, 3}_2 + +*/ + +/* { dg-final { scan-tree-dump-times "nb_iterations 100" 1 "scev"} } */ +/* { dg-final { scan-tree-dump-times "nb_iterations 26" 1 "scev"} } */ + + |