PR c/56980
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / inline-3.c
blobd97f0c65444b4675b77233addc502794d835a7d8
1 /* Verify that do_work is detected as being loop invariant. */
2 /* { dg-do compile } */
3 /* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining" } */
5 struct bah {int a,b,d;};
7 static int do_work (struct bah s)
9 return s.a*s.b/s.d;
11 int foo (int invariant)
13 int i;
14 struct bah s = {invariant,invariant,invariant};
15 int sum = 0;
16 for (i = 0; i<10; i++)
18 sum += do_work (s);
20 return sum;
24 /* { dg-final { scan-ipa-dump "Scaling time by probability:0.100000" "inline" } } */
25 /* { dg-final { cleanup-ipa-dump "inline" } } */