aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c
new file mode 100644
index 00000000000..f293f9b8c37
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int main(void)
+{
+ unsigned a;
+ int b;
+ int c;
+
+ /* loop_1 runs exactly 4 times. */
+ for (a = 22; a < 50; a+=1)
+ {
+ /* loop_2 runs exactly 6 times. On exit, the variable B is equal to 53. */
+ for (b = 23; b < 50; b+=5)
+ {
+ ++a;
+
+ /* loop_3 runs {{77, +, -7}_1, +, -1}_2 times. */
+ for (c = a; c < 100; c++)
+ {
+
+ }
+ }
+ }
+}
+
+/* The analyzer has to detect the following evolution functions:
+ b -> {23, +, 5}_2
+ a -> {{22, +, 7}_1, +, 1}_2
+ c -> {{{23, +, 7}_1, +, 1}_2, +, 1}_3
+*/
+/* { dg-final { scan-tree-dump-times "nb_iterations 4" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 6" 1 "scev"} } */
+
+