aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c
new file mode 100644
index 00000000000..4baecaceb1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details" } */
+
+int main(void)
+{
+ int a;
+ int b;
+ int *c;
+
+ /* The following loop runs exactly 3 times. */
+ for (a = 11; a < 50; a++)
+ {
+ /* The following loop runs exactly 9 times. */
+ for (b = 8; b < 50; b+=5)
+ {
+ c[a + 5] = 5;
+ c[b] = 6;
+ a+=2;
+ }
+ }
+}
+
+/* The analyzer has to detect the following evolution functions:
+ b -> {8, +, 5}_2
+ a -> {{11, +, 19}_1, +, 2}_2
+*/
+/* { dg-final { scan-tree-dump-times "nb_iterations 3" 1 "scev"} } */
+/* { dg-final { scan-tree-dump-times "nb_iterations 9" 1 "scev"} } */