summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/tree-ssa/loop-5.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/loop-5.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-5.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-5.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-5.c
new file mode 100644
index 00000000000..4ec6fd04bcd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-5.c
@@ -0,0 +1,26 @@
+/* A test for induction variable merging. */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-vars" } */
+
+void foo(int);
+
+void xxx(void)
+{
+ int iter, jter;
+
+ for (iter = 0, jter = 2; iter < 100; iter++, jter++)
+ {
+ foo (iter);
+ foo (jter);
+ }
+}
+
+/* Only iter variable should remain. */
+
+/* { dg-final { scan-tree-dump-times "int iter" 1 "vars" } } */
+/* { dg-final { scan-tree-dump-times "jter" 0 "vars" } } */
+
+/* And the use of jter should be replaced by iter + 2 */
+
+/* { dg-final { scan-tree-dump-times " \\+ 2" 1 "vars" } } */
OpenPOWER on IntegriCloud