PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / remref-2a.c
blob34a6188249f5d776914d97969a09d78ce22cebf9
1 /* Verify that indirect inlining can also remove references of the functions it
2 discovers calls for. */
3 /* { dg-do compile } */
4 /* { dg-options "-O3 -fno-early-inlining -fno-ipa-cp -fdump-ipa-inline -fdump-tree-optimized -fno-ipa-icf" } */
6 int global;
8 void __attribute__ ((noinline, noclone, used))
9 stuff (int i)
11 global = i;
14 int __attribute__ ((noinline,noclone)) get_input(void)
16 return 1;
19 static void
20 hooray_1 ()
22 stuff (1);
25 static inline void
26 hip2_1 (void (*g)())
28 int i;
29 g ();
30 /* Some stuff to make the function bigger so that hip1_1 gets inlined
31 fiorst. */
32 for (i = 0; i < get_input (); i++)
34 stuff (2);
35 stuff (2+2);
39 static inline void
40 hip1_1 (void (*g)())
42 hip2_1 (g);
45 static void
46 hooray_2 ()
48 stuff (1);
51 static inline void
52 hip2_2 (void (*g)())
54 g ();
57 static inline void
58 hip1_2 (void (*g)())
60 int i;
62 hip2_2 (g);
64 /* Some stuff to make the function bigger so that hip2_2 gets inlined
65 fiorst. */
66 for (i = 0; i < get_input (); i++)
68 stuff (2);
69 stuff (2+2);
74 int
75 main (int argc, int *argv[])
77 int i;
79 for (i = 0; i < get_input (); i++)
81 hip1_1 (hooray_1);
82 hip1_2 (hooray_2);
84 return 0;
87 /* { dg-final { scan-ipa-dump-times "ipa-prop: Removed a reference" 2 "inline" } } */
88 /* { dg-final { scan-tree-dump-not "hooray" "optimized" } } */