1 /* { dg-do compile { target { arm_thumb2_ok } } } */
2 /* { dg-options "-O2 -fdump-rtl-loop2_invariant " } */
3 
4 int t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
5 extern void foo2 (int *, int *, int *, int *, int *, int *);
6 extern int foo3 (int, int, int, int, int, int);
foo(int a,int b,int c,int d)7 int foo (int a, int b, int c, int d)
8 {
9    int i = a;
10 
11    for (; i > 0; i += b)
12     {
13       if (a > 0x1234567)
14 	foo2 (&t1, &t2, &t3, &t4, &t5, &t6);
15       foo2 (&t1, &t2, &t3, &t4, &t5, &t6);
16       if (b > 0x1234567)
17 	foo2 (&t7, &t2, &t8, &t4, &t5, &t6);
18       foo2 (&t1, &t2, &t3, &t4, &t5, &t6);
19       if (c > 0x1234567)
20 	foo2 (&t1, &t9, &t10, &t4, &t5, &t6);
21       t2 = t5 - d;
22     }
23 
24  return foo3 (t1, t2, t3, t4, t5, t6);
25 }
26 
27 /* { dg-final { scan-rtl-dump "Decided to move invariant 0" "loop2_invariant" } } */
28 
29