summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-4.c221
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-5.c124
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-6.c72
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-7.c157
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inline-6.c42
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-1.c16
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-3.c37
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-5.c13
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c42
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-8.c41
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-9.c44
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa.exp2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c37
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c43
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c44
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c62
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c68
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c75
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c54
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c52
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c45
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr55260.c38
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr56988.c38
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr57294.c18
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr57347.c27
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr57358.c9
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr57539.c218
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr58106.c50
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr58492.c7
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr59008.c32
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr59610.c11
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr61986.c48
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pure-const-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-0.c30
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-1a.c34
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-1b.c37
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-2a.c90
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-2b.c94
53 files changed, 2099 insertions, 28 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-1.c b/gcc/testsuite/gcc.dg/ipa/iinline-1.c
index 617c484994..860b3e5720 100644
--- a/gcc/testsuite/gcc.dg/ipa/iinline-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-1.c
@@ -1,7 +1,7 @@
/* Verify that simple indirect calls are inlined even without early
inlining.. */
/* { dg-do compile } */
-/* { dg-options "-O3 -c -fdump-ipa-inline -fno-early-inlining" } */
+/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */
extern void non_existent(int);
@@ -22,5 +22,6 @@ int test (void)
return 0;
}
+/* { dg-final { scan-ipa-dump "indirect_call" "inline" } } */
/* { dg-final { scan-ipa-dump "hooray\[^\\n\]*inline copy in test" "inline" } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-4.c b/gcc/testsuite/gcc.dg/ipa/iinline-4.c
new file mode 100644
index 0000000000..71faae2c97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-4.c
@@ -0,0 +1,221 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */
+
+struct S
+{
+ int i;
+ void (*f)(struct S *);
+ unsigned u;
+};
+
+struct U
+{
+ struct U *next;
+ struct S s;
+ short a[8];
+};
+
+extern void non_existent(struct S *p, int);
+
+/* ----- 1 ----- */
+
+static void hooray1 (struct S *p)
+{
+ non_existent (p, 1);
+}
+
+static void hiphip1 (struct S *p)
+{
+ p->f (p);
+}
+
+int test1 (void)
+{
+ struct S s;
+ s.i = 1234;
+ s.f = hooray1;
+ s.u = 1001;
+ hiphip1 (&s);
+ return 0;
+}
+
+/* ----- 2 ----- */
+
+struct S *gp;
+
+static void hooray2 (struct S *p)
+{
+ non_existent (p, 2);
+}
+
+static void hip2 (struct S *p)
+{
+ p->f (p);
+}
+
+static void hiphip2 (struct S *p)
+{
+ hip2 (p);
+}
+
+int test2 (void)
+{
+ struct S *p = gp;
+ p->i = 2341;
+ p->f = hooray2;
+ p->u = 1002;
+ hiphip2 (p);
+ return 0;
+}
+
+/* ----- 3 ----- */
+
+static void hooray3 (struct S *p)
+{
+ non_existent (p, 2);
+}
+
+static void hip3 (struct S *p)
+{
+ p->f (p);
+}
+
+static __attribute__ ((flatten)) void hiphip3 (struct S *p)
+{
+ hip3 (p);
+}
+
+int test3 (void)
+{
+ struct S *p = gp;
+ p->i = 2341;
+ p->f = hooray3;
+ p->u = 1003;
+ hiphip3 (p);
+ return 0;
+}
+
+/* ----- 4 ----- */
+
+static void hooray4 (struct S *p)
+{
+ non_existent (p, 3);
+}
+
+static void hiphip4 (struct S s)
+{
+ s.f (&s);
+}
+
+int test4(void)
+{
+ struct S s;
+ s.i = 3412;
+ s.f = hooray4;
+ s.u = 1004;
+ hiphip4 (s);
+ return 0;
+}
+
+/* ----- 5 ----- */
+
+struct U *gu;
+
+static void hooray5 (struct S *p)
+{
+ non_existent (p, 5);
+}
+
+static void hip5 (struct S *p)
+{
+ p->f (p);
+}
+
+static void hiphip5 (struct U *u)
+{
+ hip5 (&u->s);
+}
+
+int test5 (void)
+{
+ struct U *u = gu;
+ u->next = u;
+ u->s.i = 9876;
+ u->s.f = hooray5;
+ u->s.u = 1005;
+ hiphip5 (u);
+ return 0;
+}
+
+/* ----- 6 ----- */
+
+static void hooray6 (struct S *p)
+{
+ non_existent (p, 6);
+}
+
+static void hip6 (struct S *p)
+{
+ p->f (p);
+}
+
+static __attribute__ ((flatten)) void hiphip6 (struct U *u)
+{
+ hip6 (&u->s);
+}
+
+int test6 (void)
+{
+ struct U *u = gu;
+ u->next = u;
+ u->s.i = 9876;
+ u->s.f = hooray6;
+ u->s.u = 1006;
+ hiphip6 (u);
+ return 0;
+}
+
+/* ----- 7 ----- */
+
+struct S **gdp;
+
+
+static void hooray7 (struct S *p)
+{
+ non_existent (p, 7);
+}
+
+static void hip7 (struct S *p)
+{
+ p->f (p);
+ gdp = &p;
+}
+
+static void hiphip7 (struct S *p)
+{
+ hip7 (p);
+ gdp = &p;
+}
+
+int test7 (void)
+{
+ struct S *p = gp;
+ p->i = 7341;
+ p->f = hooray7;
+ p->u = 1007;
+ hiphip7 (p);
+ return 0;
+}
+
+
+
+/* { dg-final { scan-ipa-dump "hooray1\[^\\n\]*inline copy in test1" "inline" } } */
+/* { dg-final { scan-ipa-dump "hooray2\[^\\n\]*inline copy in test2" "inline" } } */
+/* { dg-final { scan-ipa-dump "hooray3\[^\\n\]*inline copy in test3" "inline" } } */
+/* { dg-final { scan-ipa-dump "hooray4\[^\\n\]*inline copy in test4" "inline" { xfail { { hppa*-*-* } && { ! lp64 } } } } } */
+/* { dg-final { scan-ipa-dump "hooray5\[^\\n\]*inline copy in test5" "inline" } } */
+/* { dg-final { scan-ipa-dump "hooray6\[^\\n\]*inline copy in test6" "inline" } } */
+/* { dg-final { scan-ipa-dump "hooray7\[^\\n\]*inline copy in test7" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-5.c b/gcc/testsuite/gcc.dg/ipa/iinline-5.c
new file mode 100644
index 0000000000..8fb47caffc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-5.c
@@ -0,0 +1,124 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */
+
+extern void abort (void);
+
+struct S
+{
+ int i;
+ void (*f)(struct S *);
+ int j,k,l;
+};
+
+struct Z
+{
+ unsigned u;
+ void (*f)(struct Z *, int);
+ struct Z *next;
+};
+
+static struct Z *gz;
+static struct S *gs;
+static int gr = 111;
+char gc[1024];
+
+static __attribute__ ((noinline, noclone)) struct S *
+get_s (void)
+{
+ return (struct S *) &gc;
+}
+
+
+static void wrong_target_1 (struct S *s)
+{
+ abort ();
+}
+
+static void wrong_target_2 (struct S *s)
+{
+ abort ();
+}
+
+static void wrong_target_3 (struct S *s)
+{
+ abort ();
+}
+
+static void good_target (struct Z *z, int i)
+{
+ gr = 0;
+}
+
+static void good_target_3 (struct S *s)
+{
+ gr = 0;
+}
+
+static void g1 (struct S *s)
+{
+ struct Z *z = (struct Z*) s;
+ z->f (z, 8);
+}
+
+static void f1 (struct S *s)
+{
+ gz->f = good_target;
+ g1 (s);
+}
+
+static void g2 (struct Z *z)
+{
+ z->f (z, 8);
+}
+
+static void f2 (struct S *s)
+{
+ gz->f = good_target;
+ g2 ((struct Z*) s);
+}
+
+static void g3 (struct S *s)
+{
+ s->f (s);
+}
+
+static void h3 (struct Z *z)
+{
+ gs->f = good_target_3;
+ g3 ((struct S *) z);
+}
+
+static void f3 (struct S *s)
+{
+ h3 ((struct Z*) s);
+}
+
+int main (int argc, char **argv)
+{
+ struct S *s = get_s();
+ s->i = 5678;
+ s->f = wrong_target_1;
+ s->j = 1234;
+ gz = (struct Z *) s;
+ f1 (s);
+
+ s = get_s();
+ gz = (struct Z *) s;
+ s->i = 9999;
+ s->f = wrong_target_1;
+ f2 (s);
+
+ s = get_s();
+ gs = s;
+ s->i = 9999;
+ s->f = wrong_target_3;
+ f3 (s);
+
+ return gr;
+}
+
+
+/* { dg-final { scan-ipa-dump-not "wrong_target\[^\\n\]*inline copy in" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-6.c b/gcc/testsuite/gcc.dg/ipa/iinline-6.c
new file mode 100644
index 0000000000..5a9b759d88
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-6.c
@@ -0,0 +1,72 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */
+
+extern void abort (void);
+
+struct S
+{
+ int i;
+ void (*f)(struct S *);
+ int j,k,l;
+};
+
+struct Z
+{
+ unsigned u;
+ void (*f)(struct Z *, int);
+ struct Z *next;
+};
+
+static struct S *gs;
+static int gr = 111;
+char gc[1024];
+
+static __attribute__ ((noinline, noclone)) struct S *
+get_s (void)
+{
+ return (struct S *) &gc;
+}
+
+static void wrong_target (struct S *s)
+{
+ abort ();
+}
+
+static void good_target (struct S *s)
+{
+ gr = 0;
+}
+
+static void g1 (struct S *s)
+{
+ s->f (s);
+}
+
+static void f2 (struct Z *z)
+{
+ gs->f = good_target;
+ g1 ((struct S *) z);
+}
+
+static inline __attribute__ ((flatten)) void f1 (struct S *s)
+{
+ f2 ((struct Z *) s);
+}
+
+int main (int argc, char **argv)
+{
+ struct S *s = get_s();
+ s->i = 5678;
+ s->f = wrong_target;
+ s->j = 1234;
+ gs = s;
+ f1 (s);
+
+ return gr;
+}
+
+
+/* { dg-final { scan-ipa-dump-not "wrong_target\[^\\n\]*inline copy in" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-7.c b/gcc/testsuite/gcc.dg/ipa/iinline-7.c
new file mode 100644
index 0000000000..c95d374d24
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-7.c
@@ -0,0 +1,157 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */
+
+extern void abort (void);
+
+struct S
+{
+ int i;
+ void (*f)(struct S *);
+ int j,k,l;
+};
+
+struct U
+{
+ struct U *next;
+ struct S s;
+ short a[8];
+};
+
+struct Z
+{
+ unsigned u;
+ void (*f)(struct Z *, int);
+ struct Z *next;
+};
+
+static struct Z *gz;
+static struct U *gu;
+static int gr = 111;
+char gc[1024];
+
+static __attribute__ ((noinline, noclone)) struct U *
+get_u (void)
+{
+ return (struct U *) &gc;
+}
+
+static void wrong_target_1 (struct S *s)
+{
+ abort ();
+}
+
+static void wrong_target_2 (struct S *s)
+{
+ abort ();
+}
+
+static void wrong_target_3 (struct S *s)
+{
+ abort ();
+}
+
+static void wrong_target_4 (struct S *s)
+{
+ abort ();
+}
+
+static void good_target (struct Z *z, int i)
+{
+ gr = 0;
+}
+
+static void good_target_4 (struct S *s)
+{
+ gr = 0;
+}
+
+static void g1 (struct S *s)
+{
+ struct Z *z = (struct Z*) s;
+ z->f (z, 8);
+}
+
+static void f1 (struct U *u)
+{
+ gz->f = good_target;
+ g1 (&u->s);
+}
+
+static void g2 (struct Z *z)
+{
+ z->f (z, 8);
+}
+
+static void f2 (struct U *u)
+{
+ gz->f = good_target;
+ g2 ((struct Z*) &u->s);
+}
+
+static void h3 (struct Z *z)
+{
+ z->f (z, 8);
+}
+
+static void g3 (struct S *s)
+{
+ h3 ((struct Z*) s);
+}
+
+static void f3 (struct U *u)
+{
+ gz->f = good_target;
+ g3 (&u->s);
+}
+
+static void h4 (struct S *s)
+{
+ s->f (s);
+}
+
+static void g4 (struct U *u)
+{
+ h4 (&u->s);
+}
+
+static inline __attribute__ ((flatten)) void f4 (struct Z *z)
+{
+ gu->s.f = good_target_4;
+ g4 ((struct U *) z);
+}
+
+int main (int argc, char **argv)
+{
+ struct U *u = get_u ();
+ u->next = u;
+ u->s.i = 5678;
+ u->s.f = wrong_target_1;
+ u->s.j = 1234;
+ gz = (struct Z *) &u->s;
+ f1 (u);
+
+ u = get_u();
+ u->s.i = 9999;
+ u->s.f = wrong_target_2;
+ gz = (struct Z *) &u->s;
+ f2 (u);
+
+ u = get_u();
+ u->s.i = 9998;
+ u->s.f = wrong_target_3;
+ gz = (struct Z *) &u->s;
+ f3 (u);
+
+ u = get_u();
+ u->s.i = 9998;
+ u->s.f = wrong_target_4;
+ gu = u;
+ f4 ((struct Z *) u);
+ return gr;
+}
+
+
+/* { dg-final { scan-ipa-dump-not "wrong_target\[^\\n\]*inline copy in" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/inline-6.c b/gcc/testsuite/gcc.dg/ipa/inline-6.c
new file mode 100644
index 0000000000..d981bb0064
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/inline-6.c
@@ -0,0 +1,42 @@
+/* Check statements that are eliminated by inlining. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-inline-details -fno-early-inlining -fno-partial-inlining -fno-ipa-cp" } */
+static t(int a)
+{
+ if (a==1)
+ {
+ foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo();
+ foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo();
+ foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo();
+ foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo();
+ foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo();
+ foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo();
+ foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo(); foo();
+ }
+ else if (a==2)
+ {
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar(); bar();
+ }
+ else
+ {
+ bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr();
+ bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr();
+ bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr();
+ bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr();
+ bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr();
+ bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr(); bagr();
+ }
+}
+main()
+{
+ t(1);
+ t(2);
+}
+/* Even if function is huge, inlining it will save code. */
+/* { dg-final { scan-ipa-dump-times "Inlined into" 2 "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c
new file mode 100644
index 0000000000..9810e25c19
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c
@@ -0,0 +1,16 @@
+/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */
+test (int a)
+{
+ int i;
+ for (i=0; i<a; i++)
+{
+ test2(a);
+ test2(a);
+}
+}
+m()
+{
+ test (10);
+}
+/* { dg-final { scan-ipa-dump "loop_iterations" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c
new file mode 100644
index 0000000000..a06d725562
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c
@@ -0,0 +1,13 @@
+/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */
+t(int s, void **p)
+{
+ int i;
+ for (i;i<10000;i+=s)
+ p[i]=0;
+}
+m(void **p)
+{
+ t (10, p);
+}
+/* { dg-final { scan-ipa-dump "loop_stride" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c
new file mode 100644
index 0000000000..110ae443c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c
@@ -0,0 +1,37 @@
+/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */
+void abort (void);
+int sum;
+int a[10];
+int
+scc_next (int c)
+{
+ int i;
+ for (i=0;i<c;i++)
+ a[i]=c;
+ scc_entry (c);
+}
+int
+scc_entry (int c)
+{
+ int i;
+ for (i=0;i<c;i++)
+ sum+=a[i];
+ if (c--)
+ scc_next (c);
+ return sum;
+}
+main()
+{
+ int sum;
+ int i;
+ for (i=0;i<10;i++)
+ scc_entry (i);
+ if (sum < 0)
+ abort ();
+ return 0;
+}
+/* { dg-final { scan-ipa-dump "in_scc" "inline" } } */
+/* { dg-final { scan-ipa-dump "same_scc" "inline" } } */
+/* Main is not in scc, the two functions are. */
+/* { dg-final { scan-ipa-dump-times "In SCC" 2 "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-1.c
index 3517b035f1..3cc32da1c9 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-1.c
@@ -25,7 +25,7 @@ int main ()
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-2.c b/gcc/testsuite/gcc.dg/ipa/ipa-2.c
index 122a4a0181..7f14d42a03 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-2.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-2.c
@@ -23,5 +23,5 @@ int main ()
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-3.c b/gcc/testsuite/gcc.dg/ipa/ipa-3.c
index e15f084b40..36fd506789 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-3.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-3.c
@@ -29,8 +29,8 @@ int main ()
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of g" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param b with const 7" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param c with const 3" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 b with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .1 c with const 3" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-4.c b/gcc/testsuite/gcc.dg/ipa/ipa-4.c
index 88716dd8f4..566b329713 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-4.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-4.c
@@ -26,5 +26,5 @@ int main ()
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
-/* { dg-final { scan-ipa-dump-times "replacing param a with const 7" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "replacing param .0 a with const 7" 1 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-5.c b/gcc/testsuite/gcc.dg/ipa/ipa-5.c
index 22d1be89c0..daa64fada6 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-5.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-5.c
@@ -5,7 +5,7 @@
/* Float & short constants. */
#include <stdio.h>
-void t(void);
+int t(void);
int g (float b, short c)
{
t();
@@ -13,10 +13,11 @@ int g (float b, short c)
}
int f (float a)
{
- t();
+ int i, j = t();
/* a is modified. */
if (a++ > 0)
- g (a, 3);
+ for (i = 0; i < j; i++)
+ g (a, 3);
}
int main ()
{
@@ -26,7 +27,7 @@ int main ()
return 0;
}
-/* { dg-final { scan-ipa-dump-times "Creating a specialized node" 2 "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param c with const 3" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node" 3 "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .1 c with const 3" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-7.c b/gcc/testsuite/gcc.dg/ipa/ipa-7.c
index c8b510046a..271a34a3d6 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-7.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-7.c
@@ -27,7 +27,7 @@ int main ()
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
-/* { dg-final { scan-ipa-dump-times "replacing param . with const 7" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "replacing param .. . with const 7" 1 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-8.c b/gcc/testsuite/gcc.dg/ipa/ipa-8.c
index dcbed13a0e..d138cf2633 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-8.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-8.c
@@ -23,9 +23,9 @@ int main ()
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of g" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param b with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 b with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c
index e8abc3244a..b62b08ff03 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c
@@ -21,8 +21,8 @@ int main()
void *p;
a.p = (void *)&c;
p = foo(&a, &a);
- /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* c\[^ \]* }" "pta" { xfail *-*-* } } } */
- /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* a\[^ \]* c\[^ \]* }" "pta" } } */
+ /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* c\[^ \]* }" "pta" { target { ! keeps_null_pointer_checks } } } } */
+ /* { dg-final { scan-ipa-dump "foo.result = { NONLOCAL a\[^ \]* c\[^ \]* }" "pta" { target { keeps_null_pointer_checks } } } } */
((struct X *)p)->p = (void *)0;
if (a.p != (void *)0)
abort ();
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c
index ce9393cb07..47900809b9 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c
@@ -23,6 +23,6 @@ int main()
/* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta" } } */
/* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta" } } */
-/* { dg-final { scan-tree-dump "Replaced \\\*p_1\\\(D\\\) with 1" "fre2" } } */
+/* { dg-final { scan-tree-dump "Replaced \\\*p_2\\\(D\\\) with 1" "fre2" } } */
/* { dg-final { cleanup-tree-dump "fre2" } } */
/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c
index 32e1e4fbc4..bf6fa281d5 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c
@@ -28,6 +28,6 @@ int main()
/* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta" } } */
/* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta" } } */
-/* { dg-final { scan-tree-dump "Replaced \\\*p_1\\\(D\\\) with 1" "fre2" } } */
+/* { dg-final { scan-tree-dump "Replaced \\\*p_2\\\(D\\\) with 1" "fre2" } } */
/* { dg-final { cleanup-tree-dump "fre2" } } */
/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
index c6b4d63aa7..3437a81aa2 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
@@ -1,6 +1,5 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
-/* { dg-require-effective-target non_strict_align } */
struct bovid
{
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c
new file mode 100644
index 0000000000..921334a4fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+typedef unsigned int myint __attribute__((aligned(1)));
+
+typedef struct __attribute__((packed)) S {
+ unsigned a, b, c;
+} SS;
+
+typedef SS __attribute__((aligned(1))) SSS;
+
+
+static unsigned int __attribute__ ((noinline))
+get_a (SSS *p)
+{
+ return p->a;
+};
+
+static int __attribute__ ((noinline, noclone))
+foo (SS *p)
+{
+ int r = (int) get_a(p) + 2;
+ return r;
+}
+
+char buf[512];
+
+static SSS * __attribute__ ((noinline, noclone))
+get_sss (void)
+{
+ return (SSS *)(buf + 1);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ SSS *p = get_sss();
+ if (foo(p) != 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-8.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-8.c
new file mode 100644
index 0000000000..9e6e40ac54
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-8.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+typedef unsigned int myint __attribute__((aligned(1)));
+
+typedef struct S {
+ unsigned a, b, c;
+} SS;
+
+typedef SS __attribute__((aligned(1))) SSS;
+
+
+static unsigned int __attribute__ ((noinline))
+get_a (SS s)
+{
+ return s.a;
+};
+
+static int __attribute__ ((noinline, noclone))
+foo (SSS *p)
+{
+ int r = (int) get_a(*p) + 2;
+ return r;
+}
+
+char buf[512];
+
+static SSS * __attribute__ ((noinline, noclone))
+get_sss (void)
+{
+ return (SSS *)(buf + 1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ SSS *p = get_sss();
+ if (foo(p) != 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-9.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-9.c
new file mode 100644
index 0000000000..c5468cfbb7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-9.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+typedef unsigned int myint __attribute__((aligned(1)));
+
+typedef struct S {
+ unsigned a, b, c;
+} SS;
+
+typedef struct U {
+ SS s[2];
+} UU;
+
+typedef UU __attribute__((aligned(1))) UUU;
+
+static unsigned int __attribute__ ((noinline))
+get_a (SS s)
+{
+ return s.a;
+};
+
+static int __attribute__ ((noinline, noclone))
+foo (UUU *p)
+{
+ int r = (int) get_a(p->s[0]) + 2;
+ return r;
+}
+
+char buf[512];
+
+static UUU * __attribute__ ((noinline, noclone))
+get_uuu (void)
+{
+ return (UUU *)(buf + 1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ UUU *p = get_uuu();
+ if (foo(p) != 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa.exp b/gcc/testsuite/gcc.dg/ipa/ipa.exp
index 1bbfee7cf2..3c3c600aef 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa.exp
+++ b/gcc/testsuite/gcc.dg/ipa/ipa.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2004, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-1.c b/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
index 0f50ff9276..a2ffd42020 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
@@ -46,7 +46,7 @@ main (int argc, char *argv[])
/* { dg-final { scan-ipa-dump "Creating a specialized node of f.*for all known contexts" "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-2.c b/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
index c6dcdf0af5..62f564f216 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
@@ -94,6 +94,6 @@ top2 (int q)
}
/* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo" 1 "cp" } } */
-/* { dg-final { scan-ipa-dump-times "replacing param p with const 0" 3 "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param s with const 4" "cp" } } */
+/* { dg-final { scan-ipa-dump-times "replacing param .. p with const 0" 3 "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 s with const 4" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-4.c b/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
index 59018ca6b1..462cade498 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
@@ -61,8 +61,8 @@ main (int argc, char *argv[])
/* { dg-final { scan-ipa-dump "Creating a specialized node of g1.*for all known contexts" "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of g2.*for all known contexts" "cp" } } */
/* { dg-final { scan-ipa-dump-not "Creating a specialized node of h.*for all known contexts" "cp" } } */
-/* { dg-final { scan-ipa-dump-times "replacing param a with const 7" 2 "cp" } } */
-/* { dg-final { scan-ipa-dump "replacing param a with const 11" "cp" } } */
+/* { dg-final { scan-ipa-dump-times "replacing param .0 a with const 7" 2 "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 11" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c
new file mode 100644
index 0000000000..b2e04f8724
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline))
+foo (struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b;
+ void *v = (void *) p;
+
+ for (i= 0; i< c; i++)
+ v = blah(b + i, v);
+}
+
+void
+entry (void)
+{
+ struct S s;
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ foo (&s);
+}
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of foo.*for all known contexts" "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 2 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c
new file mode 100644
index 0000000000..7edfa408a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline))
+foo (struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b;
+ void *v = (void *) p;
+
+ for (i= 0; i< c; i++)
+ v = blah(b + i, v);
+}
+
+void
+entry (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ foo (&s);
+ }
+ s.c = 2;
+ foo (&s);
+}
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 4 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c
new file mode 100644
index 0000000000..4c0a3e7c54
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline))
+foo (int z, struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b;
+ void *v = (void *) p;
+
+ for (i= 0; i< c; i++)
+ v = blah(b + i, v);
+}
+
+void
+entry (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ foo (i, &s);
+ }
+ s.c = 2;
+ foo (0, &s);
+}
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate replacements: 1" 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate replacements: 0" 2 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c
new file mode 100644
index 0000000000..1c1da4d684
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c
@@ -0,0 +1,62 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline))
+foo (struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b;
+ void *v = (void *) p;
+
+ for (i= 0; i< c; i++)
+ v = blah(b + i, v);
+}
+
+
+void
+entry1 (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ foo (&s);
+ }
+ s.c = 2;
+ foo (&s);
+}
+
+void
+entry2 (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 6;
+ s.b = 64;
+ s.c = 32;
+ foo (&s);
+ }
+ s.c = 2;
+ foo (&s);
+}
+
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 4 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c
new file mode 100644
index 0000000000..9f6ee5beea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c
@@ -0,0 +1,68 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline))
+foo (struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b;
+ void *v = (void *) p;
+
+ for (i= 0; i< c; i++)
+ v = blah(b + i, v);
+}
+
+static void __attribute__ ((noinline))
+bar (struct S *p)
+{
+ foo (p);
+}
+
+void
+entry1 (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ bar (&s);
+ }
+ s.c = 2;
+ bar (&s);
+}
+
+void
+entry2 (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 6;
+ s.b = 64;
+ s.c = 32;
+ foo (&s);
+ }
+ s.c = 2;
+ foo (&s);
+}
+
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of bar/\[0-9\]*\\." 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 8 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c
new file mode 100644
index 0000000000..050e13bf50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c
@@ -0,0 +1,75 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline))
+foo (struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b;
+ void *v = (void *) p;
+
+ for (i= 0; i< c; i++)
+ v = blah(b + i, v);
+}
+
+static void __attribute__ ((noinline))
+bar (struct S *p)
+{
+ foo (p);
+}
+
+static void __attribute__ ((noinline))
+bar_2 (struct S *p)
+{
+ foo (p);
+}
+
+void
+entry1 (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ bar (&s);
+ }
+ s.c = 2;
+ bar (&s);
+}
+
+void
+entry2 (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = 6;
+ s.b = 64;
+ s.c = 32;
+ bar_2 (&s);
+ }
+ s.c = 2;
+ foo (&s);
+}
+
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of bar/\[0-9\]*\\." 2 "cp" } } */
+/* { dg-final { scan-ipa-dump "Creating a specialized node of bar_2.*for all known contexts" "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 10 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c
new file mode 100644
index 0000000000..e85ca1a9d0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline)) foo (int x, int z, struct S *p);
+
+static void __attribute__ ((noinline))
+bar (int x, int z, struct S *p)
+{
+ foo (z, x, p);
+}
+
+static void __attribute__ ((noinline))
+foo (int x, int z, struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b - z;
+ void *v = (void *) p;
+
+ if (z)
+ {
+ z--;
+ bar (z, x, p);
+ }
+ for (i = 0; i< c; i++)
+ v = blah(b + x + i, v);
+}
+
+void
+entry (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = c;
+ s.b = 64;
+ s.c = 32;
+ foo (4, i, &s);
+ }
+}
+/* { dg-final { scan-ipa-dump-times "Clone of bar" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Clone of foo" 1 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c
new file mode 100644
index 0000000000..5014ffd3b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-sra -fdump-tree-optimized-slim" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+void *blah(int, void *);
+
+static void __attribute__ ((noinline)) foo (int x, int z, struct S *p);
+
+static void __attribute__ ((noinline))
+bar (int x, int z, struct S *p)
+{
+ p->b = 0;
+ foo (z, x, p);
+}
+
+static void __attribute__ ((noinline))
+foo (int x, int z, struct S *p)
+{
+ int i, c = p->c;
+ int b = p->b - z;
+ void *v = (void *) p;
+
+ if (z)
+ {
+ z--;
+ bar (z, x, p);
+ }
+ for (i = 0; i< c; i++)
+ v = blah(b + x + i, v);
+}
+
+void
+entry (int c)
+{
+ struct S s;
+ int i;
+
+ for (i = 0; i<c; i++)
+ {
+ s.a = c;
+ s.b = 64;
+ s.c = 32;
+ foo (4, i, &s);
+ }
+}
+/* { dg-final { scan-tree-dump "->b;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c
new file mode 100644
index 0000000000..e6b4b965fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c
@@ -0,0 +1,45 @@
+/* Verify that IPA-CP can make edges direct based on aggregate contents. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-cp -fdump-ipa-inline" } */
+
+struct S
+{
+ int i;
+ void (*f)(struct S *);
+ unsigned u;
+};
+
+struct U
+{
+ struct U *next;
+ struct S s;
+ short a[8];
+};
+
+extern void non_existent(struct S *p, int);
+
+static void hooray1 (struct S *p)
+{
+ non_existent (p, 1);
+}
+
+static __attribute__ ((noinline))
+void hiphip1 (struct S *p)
+{
+ p->f (p);
+}
+
+int test1 (void)
+{
+ struct S s;
+ s.i = 1234;
+ s.f = hooray1;
+ s.u = 1001;
+ hiphip1 (&s);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "ipa-prop: Discovered an indirect call to a known target" "cp" } } */
+/* { dg-final { scan-ipa-dump "hooray1\[^\\n\]*inline copy in hiphip1" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/pr55260.c b/gcc/testsuite/gcc.dg/ipa/pr55260.c
new file mode 100644
index 0000000000..ef151b0a20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr55260.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-inline -fipa-cp-clone" } */
+
+typedef struct {
+ int *ptr;
+ int len;
+} string;
+typedef struct {
+ string nantstr;
+ int *nant;
+} malv;
+typedef struct {
+ int *nor;
+} list_heads;
+int b;
+list_heads *fn1(string, int *, unsigned);
+void fn2(malv *p1, list_heads *p2, unsigned p3) {
+ string a = p1->nantstr;
+ fn1(a, p1->nant, p3);
+}
+
+void fn3(unsigned p1) { fn2(0, 0, p1); }
+
+list_heads *fn1(string p1, int *p2, unsigned p3) {
+ while (1) {
+ if (p3)
+ fn3(1);
+ if (b)
+ return 0;
+ fn3(1);
+ }
+}
+
+void fn5() {
+ list_heads c;
+ c.nor = 0;
+ fn2(0, &c, 1);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr56988.c b/gcc/testsuite/gcc.dg/ipa/pr56988.c
new file mode 100644
index 0000000000..ab20159b8e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr56988.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+volatile int g;
+
+static void __attribute__ ((noinline, noclone))
+bar (struct S **p)
+{
+ g = 5;
+};
+
+static void __attribute__ ((noinline))
+foo (struct S *p)
+{
+ int i = p->a;
+ if (i != 1)
+ __builtin_abort ();
+ bar (&p);
+}
+
+int
+main (int argc, char *argv[])
+{
+ struct S s;
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ foo (&s);
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/ipa/pr57294.c b/gcc/testsuite/gcc.dg/ipa/pr57294.c
new file mode 100644
index 0000000000..0871f3f418
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr57294.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+void baz (void);
+int func ();
+
+static void
+bar (int a, int foo (void))
+{
+ baz ();
+ foo ();
+}
+
+void
+baz (void)
+{
+ bar (0, func);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr57347.c b/gcc/testsuite/gcc.dg/ipa/pr57347.c
new file mode 100644
index 0000000000..731b4868ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr57347.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+struct S1 { int f0; int f1 : 10; int f2 : 13; };
+int i;
+int *j = &i;
+
+static void
+foo (struct S1 s)
+{
+ int *p;
+ int l[88];
+ int **pp = &p;
+ *pp = &l[1];
+ l[0] = 1;
+ *j = 1 && s.f2;
+}
+
+int
+main ()
+{
+ struct S1 s = { 0, 0, 1 };
+ foo (s);
+ if (i != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr57358.c b/gcc/testsuite/gcc.dg/ipa/pr57358.c
new file mode 100644
index 0000000000..c83396f4c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr57358.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct t { void (*func)(void*); };
+void test_func(struct t* a) __attribute__((optimize("O0")));
+void test_func(struct t* a)
+{
+ a->func(0);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr57539.c b/gcc/testsuite/gcc.dg/ipa/pr57539.c
new file mode 100644
index 0000000000..e02018eb87
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr57539.c
@@ -0,0 +1,218 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef long unsigned int size_t;
+typedef struct
+{
+}
+box;
+typedef struct
+{
+}
+textpara_t;
+typedef struct _dtlink_s Dtlink_t;
+typedef struct _dtdisc_s Dtdisc_t;
+typedef struct _dtmethod_s Dtmethod_t;
+typedef struct _dt_s Dt_t;
+typedef void *(*Dtmemory_f) (Dt_t *, void *, size_t, Dtdisc_t *);
+typedef void *(*Dtsearch_f) (Dt_t *, void *, int);
+typedef void *(*Dtmake_f) (Dt_t *, void *, Dtdisc_t *);
+typedef void (*Dtfree_f) (Dt_t *, void *, Dtdisc_t *);
+typedef int (*Dtcompar_f) (Dt_t *, void *, void *, Dtdisc_t *);
+typedef unsigned int (*Dthash_f) (Dt_t *, void *, Dtdisc_t *);
+typedef int (*Dtevent_f) (Dt_t *, int, void *, Dtdisc_t *);
+struct _dtlink_s
+{
+ Dtlink_t *right;
+};
+struct _dtdisc_s
+{
+ int key;
+ int size;
+ int link;
+ Dtmake_f makef;
+ Dtfree_f freef;
+ Dtcompar_f comparf;
+ Dthash_f hashf;
+ Dtmemory_f memoryf;
+ Dtevent_f eventf;
+};
+struct _dt_s
+{
+ Dtsearch_f searchf;
+};
+extern Dtmethod_t *Dtobag;
+extern Dt_t *dtopen (Dtdisc_t *, Dtmethod_t *);
+extern Dtlink_t *dtflatten (Dt_t *);
+typedef struct Agobj_s Agobj_t;
+typedef struct Agraph_s Agraph_t;
+typedef struct Agnode_s Agnode_t;
+typedef struct Agedge_s Agedge_t;
+typedef struct Agdesc_s Agdesc_t;
+typedef struct Agdisc_s Agdisc_t;
+typedef struct Agrec_s Agrec_t;
+struct Agobj_s
+{
+ Agrec_t *data;
+};
+struct Agdesc_s
+{
+};
+extern Agraph_t *agopen (char *name, Agdesc_t desc, Agdisc_t * disc);
+extern Agnode_t *agfstnode (Agraph_t * g);
+extern Agnode_t *agnxtnode (Agraph_t * g, Agnode_t * n);
+extern Agedge_t *agedge (Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name,
+ int createflag);
+extern Agedge_t *agfstout (Agraph_t * g, Agnode_t * n);
+extern Agedge_t *agnxtout (Agraph_t * g, Agedge_t * e);
+extern Agdesc_t Agdirected, Agstrictdirected, Agundirected,
+ Agstrictundirected;
+typedef struct Agraph_s graph_t;
+typedef struct Agnode_s node_t;
+typedef struct Agedge_s edge_t;
+typedef union inside_t
+{
+ unsigned short minlen;
+}
+Agedgeinfo_t;
+extern void *gmalloc (size_t);
+typedef enum
+{ AM_NONE, AM_VOR, AM_SCALE, AM_NSCALE, AM_SCALEXY, AM_PUSH, AM_PUSHPULL,
+ AM_ORTHO, AM_ORTHO_YX, AM_ORTHOXY, AM_ORTHOYX, AM_PORTHO, AM_PORTHO_YX,
+ AM_PORTHOXY, AM_PORTHOYX, AM_COMPRESS, AM_VPSC, AM_IPSEP, AM_PRISM }
+adjust_mode;
+typedef struct nitem
+{
+ Dtlink_t link;
+ int val;
+ node_t *cnode;
+ box bb;
+}
+nitem;
+typedef int (*distfn) (box *, box *);
+typedef int (*intersectfn) (nitem *, nitem *);
+static int
+cmpitem (Dt_t * d, int *p1, int *p2, Dtdisc_t * disc)
+{
+}
+static Dtdisc_t constr =
+ { __builtin_offsetof (nitem, val), sizeof (int), __builtin_offsetof (nitem,
+ link),
+((Dtmake_f) 0), ((Dtfree_f) 0), (Dtcompar_f) cmpitem, ((Dthash_f) 0), ((Dtmemory_f) 0),
+((Dtevent_f) 0) };
+static int
+distX (box * b1, box * b2)
+{
+}
+
+static int
+intersectY0 (nitem * p, nitem * q)
+{
+}
+
+static int
+intersectY (nitem * p, nitem * q)
+{
+}
+
+static void
+mapGraphs (graph_t * g, graph_t * cg, distfn dist)
+{
+ node_t *n;
+ edge_t *e;
+ edge_t *ce;
+ node_t *t;
+ node_t *h;
+ nitem *tp;
+ nitem *hp;
+ int delta;
+ for (n = agfstnode (g); n; n = agnxtnode (g, n))
+ {
+ for (e = agfstout (g, n); e; e = agnxtout (g, e))
+ {
+ delta = dist (&tp->bb, &hp->bb);
+ ce = agedge (cg, t, h, ((void *) 0), 1);
+ if ((((Agedgeinfo_t *) (((Agobj_t *) (ce))->data))->minlen) < delta)
+ {
+ if ((((Agedgeinfo_t *) (((Agobj_t *) (ce))->data))->minlen) ==
+ 0.0)
+ {
+ }
+ }
+ }
+ }
+}
+
+static graph_t *
+mkNConstraintG (graph_t * g, Dt_t * list, intersectfn intersect, distfn dist)
+{
+ nitem *p;
+ nitem *nxp;
+ edge_t *e;
+ graph_t *cg = agopen ("cg", Agstrictdirected, ((Agdisc_t *) 0));
+ for (p = (nitem *) dtflatten (list); p;
+ p = (nitem *) (((Dtlink_t *) ((Dtlink_t *) p))->right))
+ {
+ for (nxp = (nitem *) (((Dtlink_t *) ((Dtlink_t *) p))->right); nxp;
+ nxp = (nitem *) (((Dtlink_t *) ((Dtlink_t *) nxp))->right))
+ {
+ if (intersect (p, nxp))
+ {
+ e = agedge (cg, p->cnode, nxp->cnode, ((void *) 0), 1);
+ }
+ }} for (p = (nitem *) dtflatten (list); p;
+ p = (nitem *) (((Dtlink_t *) ((Dtlink_t *) p))->right))
+ {
+ }
+}
+
+static graph_t *
+mkConstraintG (graph_t * g, Dt_t * list, intersectfn intersect, distfn dist)
+{
+ graph_t *vg;
+ graph_t *cg = agopen ("cg", Agstrictdirected, ((Agdisc_t *) 0));
+ mapGraphs (vg, cg, dist);
+}
+
+static void
+constrainX (graph_t * g, nitem * nlist, int nnodes, intersectfn ifn,
+ int ortho)
+{
+ Dt_t *list = dtopen (&constr, Dtobag);
+ nitem *p = nlist;
+ graph_t *cg;
+ int i;
+ for (i = 0; i < nnodes; i++)
+ {
+ (*(((Dt_t *) (list))->searchf)) ((list), (void *) (p), 0000001);
+ p++;
+ } if (ortho)
+ cg = mkConstraintG (g, list, ifn, distX);
+ else
+ cg = mkNConstraintG (g, list, ifn, distX);
+}
+
+int
+cAdjust (graph_t * g, int mode)
+{
+ int ret, i, nnodes = agnnodes (g);
+ nitem *nlist = (nitem *) gmalloc ((nnodes) * sizeof (nitem));
+ node_t *n;
+ for (n = agfstnode (g); n; n = agnxtnode (g, n))
+ {
+ }
+ if (overlaps (nlist, nnodes))
+ {
+ switch ((adjust_mode) mode)
+ {
+ case AM_ORTHOXY:
+ constrainX (g, nlist, nnodes, intersectY, 1);
+ case AM_ORTHO:
+ constrainX (g, nlist, nnodes, intersectY0, 1);
+ constrainX (g, nlist, nnodes, intersectY, 1);
+ case AM_PORTHO:
+ default:
+ constrainX (g, nlist, nnodes, intersectY0, 0);
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr58106.c b/gcc/testsuite/gcc.dg/ipa/pr58106.c
new file mode 100644
index 0000000000..b83353c4e9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr58106.c
@@ -0,0 +1,50 @@
+/* PR 58106 testcase. Verify that rdesc chain creating and lookup works with
+ recursive inlining and master clone creation. */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef struct rtx_def *rtx;
+enum rtx_code {
+ LAST_AND_UNUSED_RTX_CODE};
+extern const char * const rtx_format[((int) LAST_AND_UNUSED_RTX_CODE)];
+struct rtx_def {
+ enum rtx_code code;
+};
+typedef int (*rtx_function) (rtx *, void *);
+extern int for_each_rtx (rtx *, rtx_function, void *);
+int
+replace_label (rtx *x, void *data)
+{
+ rtx l = *x;
+ if (l == (rtx) 0)
+ {
+ {
+ rtx new_c, new_l;
+ for_each_rtx (&new_c, replace_label, data);
+ }
+ }
+}
+static int
+for_each_rtx_1 (rtx exp, int n, rtx_function f, void *data)
+{
+ int result, i, j;
+ const char *format = (rtx_format[(int) (((enum rtx_code) (exp)->code))]);
+ rtx *x;
+ for (; format[n] != '\0'; n++)
+ {
+ switch (format[n])
+ {
+ case 'e':
+ result = (*f) (x, data);
+ {
+ result = for_each_rtx_1 (*x, i, f, data);
+ }
+ }
+ }
+}
+int
+for_each_rtx (rtx *x, rtx_function f, void *data)
+{
+ int i;
+ return for_each_rtx_1 (*x, i, f, data);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr58492.c b/gcc/testsuite/gcc.dg/ipa/pr58492.c
new file mode 100644
index 0000000000..79958d5640
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr58492.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-pta" } */
+
+void f(int p, short q)
+{
+ f(0, 0);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr59008.c b/gcc/testsuite/gcc.dg/ipa/pr59008.c
new file mode 100644
index 0000000000..b729672430
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr59008.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef int (*funct)(int, int, int);
+
+extern int f(int, int, int);
+extern int g(int, int, int);
+extern int h(int, funct, funct);
+
+static int baz(int x, int y, int z)
+{
+ return x + y + z;
+}
+
+static int bar(int n, funct f1, funct f2)
+{
+ return h(n, f1, f2) + f1(0, 1, 2);
+}
+
+static int foo(int n, funct f1, funct f2)
+{
+ return bar(n, f1, f2) + f2(0, 1, 2);
+}
+
+int main(void)
+{
+ return foo(0, f, g)
+#ifndef ICE2
+ + foo(0, baz, g)
+#endif
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr59610.c b/gcc/testsuite/gcc.dg/ipa/pr59610.c
new file mode 100644
index 0000000000..fc0933441e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr59610.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct A { int a; };
+extern void *y;
+
+__attribute__((optimize (0))) void
+foo (void *p, struct A x)
+{
+ foo (y, x);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr61986.c b/gcc/testsuite/gcc.dg/ipa/pr61986.c
new file mode 100644
index 0000000000..8d2f658b87
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr61986.c
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a, b, c;
+
+struct S
+{
+ int f0;
+ int f1;
+} d;
+
+static int fn2 (struct S);
+void fn3 (struct S);
+
+void
+fn1 (struct S p)
+{
+ struct S h = { 0, 0 };
+ fn3 (p);
+ fn2 (h);
+}
+
+int
+fn2 (struct S p)
+{
+ struct S j = { 0, 0 };
+ fn3 (p);
+ fn2 (j);
+ return 0;
+}
+
+void
+fn3 (struct S p)
+{
+ for (; b; a++)
+ c = p.f0;
+ fn1 (d);
+}
+
+void
+fn4 ()
+{
+ for (;;)
+ {
+ struct S f = { 0, 0 };
+ fn1 (f);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pure-const-1.c b/gcc/testsuite/gcc.dg/ipa/pure-const-1.c
index 51837ea9ba..f76dd87d4d 100644
--- a/gcc/testsuite/gcc.dg/ipa/pure-const-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/pure-const-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target nonpic } } */
/* { dg-options "-O3 -fdump-tree-local-pure-const1 -fdump-ipa-pure-const -fdump-tree-optimized -fno-early-inlining" } */
void abort (void);
int error_code;
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-0.c b/gcc/testsuite/gcc.dg/ipa/remref-0.c
new file mode 100644
index 0000000000..a9e434a86d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-0.c
@@ -0,0 +1,30 @@
+/* Verify that indirect inlining machinery can remove references to functions
+ passed as parameters that are never used. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-early-inlining -fno-ipa-sra -fno-ipa-cp -fdump-ipa-inline -fdump-tree-optimized" } */
+
+extern int __attribute__ ((noinline, noclone, used))
+stuff (int i)
+{
+ return 0;
+}
+
+static void hooray ()
+{
+ stuff (1);
+}
+
+static int hiphip (void (*f)())
+{
+ return stuff (2);
+}
+
+int main (void)
+{
+ return hiphip (hooray);
+}
+
+/* { dg-final { scan-ipa-dump "ipa-prop: Removed a reference" "inline" } } */
+/* { dg-final { scan-tree-dump-not "hooray" "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-1a.c b/gcc/testsuite/gcc.dg/ipa/remref-1a.c
new file mode 100644
index 0000000000..9db2bd6192
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-1a.c
@@ -0,0 +1,34 @@
+/* Verify that indirect inlining can also remove references of the functions it
+ discovers calls for. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-early-inlining -fno-ipa-cp -fdump-ipa-inline -fdump-tree-optimized" } */
+
+int global;
+
+void __attribute__ ((noinline, noclone, used))
+stuff (int i)
+{
+ global = i;
+}
+
+static void hooray ()
+{
+ stuff (1);
+}
+
+static void hiphip (void (*f)())
+{
+ stuff (2);
+ f ();
+}
+
+int main (void)
+{
+ hiphip (hooray);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "ipa-prop: Removed a reference" "inline" } } */
+/* { dg-final { scan-tree-dump-not "hooray" "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-1b.c b/gcc/testsuite/gcc.dg/ipa/remref-1b.c
new file mode 100644
index 0000000000..a17cf4828a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-1b.c
@@ -0,0 +1,37 @@
+/* Verify that indirect inlining can also remove references of the functions it
+ discovers calls for, even when nodes being inlined are virtual IPA-CP
+ clones. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-cp-details -fdump-ipa-inline -fdump-tree-optimized" } */
+
+int global;
+
+void __attribute__ ((noinline, noclone, used))
+stuff (int i)
+{
+ global = i;
+}
+
+static void hooray ()
+{
+ stuff (1);
+}
+
+static void hiphip (void (*f)())
+{
+ stuff (2);
+ f ();
+}
+
+int main (void)
+{
+ hiphip (hooray);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "removing its cloning-created reference" "cp" } } */
+/* { dg-final { scan-ipa-dump "ipa-prop: Removed a reference" "inline" } } */
+/* { dg-final { scan-tree-dump-not "hooray" "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-2a.c b/gcc/testsuite/gcc.dg/ipa/remref-2a.c
new file mode 100644
index 0000000000..1e0df2e84d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-2a.c
@@ -0,0 +1,90 @@
+/* Verify that indirect inlining can also remove references of the functions it
+ discovers calls for. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-early-inlining -fno-ipa-cp -fdump-ipa-inline -fdump-tree-optimized" } */
+
+int global;
+
+void __attribute__ ((noinline, noclone, used))
+stuff (int i)
+{
+ global = i;
+}
+
+int __attribute__ ((noinline,noclone)) get_input(void)
+{
+ return 1;
+}
+
+static void
+hooray_1 ()
+{
+ stuff (1);
+}
+
+static inline void
+hip2_1 (void (*g)())
+{
+ int i;
+ g ();
+ /* Some stuff to make the function bigger so that hip1_1 gets inlined
+ fiorst. */
+ for (i = 0; i < get_input (); i++)
+ {
+ stuff (2);
+ stuff (2+2);
+ }
+}
+
+static inline void
+hip1_1 (void (*g)())
+{
+ hip2_1 (g);
+}
+
+static void
+hooray_2 ()
+{
+ stuff (1);
+}
+
+static inline void
+hip2_2 (void (*g)())
+{
+ g ();
+}
+
+static inline void
+hip1_2 (void (*g)())
+{
+ int i;
+
+ hip2_2 (g);
+
+ /* Some stuff to make the function bigger so that hip2_2 gets inlined
+ fiorst. */
+ for (i = 0; i < get_input (); i++)
+ {
+ stuff (2);
+ stuff (2+2);
+ }
+}
+
+
+int
+main (int argc, int *argv[])
+{
+ int i;
+
+ for (i = 0; i < get_input (); i++)
+ {
+ hip1_1 (hooray_1);
+ hip1_2 (hooray_2);
+ }
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump-times "ipa-prop: Removed a reference" 2 "inline" } } */
+/* { dg-final { scan-tree-dump-not "hooray" "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-2b.c b/gcc/testsuite/gcc.dg/ipa/remref-2b.c
new file mode 100644
index 0000000000..554f306d26
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/remref-2b.c
@@ -0,0 +1,94 @@
+/* Verify that indirect inlining can also remove references of the functions it
+ discovers calls for, even when nodes being inlined are virtual IPA-CP
+ clones. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-cp-details -fdump-ipa-inline -fdump-tree-optimized" } */
+
+
+int global;
+
+void __attribute__ ((noinline, noclone, used))
+stuff (int i)
+{
+ global = i;
+}
+
+int __attribute__ ((noinline,noclone)) get_input(void)
+{
+ return 1;
+}
+
+static void
+hooray_1 ()
+{
+ stuff (1);
+}
+
+static inline void
+hip2_1 (void (*g)())
+{
+ int i;
+ g ();
+ /* Some stuff to make the function bigger so that hip1_1 gets inlined
+ fiorst. */
+ for (i = 0; i < get_input (); i++)
+ {
+ stuff (2);
+ stuff (2+2);
+ }
+}
+
+static inline void
+hip1_1 (void (*g)())
+{
+ hip2_1 (g);
+}
+
+static void
+hooray_2 ()
+{
+ stuff (1);
+}
+
+static inline void
+hip2_2 (void (*g)())
+{
+ g ();
+}
+
+static inline void
+hip1_2 (void (*g)())
+{
+ int i;
+
+ hip2_2 (g);
+
+ /* Some stuff to make the function bigger so that hip2_2 gets inlined
+ fiorst. */
+ for (i = 0; i < get_input (); i++)
+ {
+ stuff (2);
+ stuff (2+2);
+ }
+}
+
+int
+main (int argc, int *argv[])
+{
+ int i;
+
+ for (i = 0; i < get_input (); i++)
+ {
+ hip1_1 (hooray_1);
+ hip1_2 (hooray_2);
+ }
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump-times "removing its cloning-created reference" 2 "cp" } } */
+/* { dg-final { scan-ipa-dump "ipa-prop: Removed a reference" "inline" } } */
+/* { dg-final { scan-ipa-dump-times "ipa-prop: Removing cloning-created reference" 2 "inline" } } */
+/* { dg-final { scan-tree-dump-not "hooray" "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */