aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/ipa
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/ipa
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/ipa')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-1.c27
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-2.c41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-3.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-4.c221
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-5.c124
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-6.c72
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-7.c157
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-1.c37
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-2.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-3.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-4.c29
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-5.c36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-6.c42
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c16
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c37
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-1.c31
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-2.c27
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-3.c36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-4.c30
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-5.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-6.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-7.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-8.c31
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-1.c50
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-10.c30
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-11.c36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-12.c34
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c62
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c32
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-15.c32
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-2.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c28
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c33
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-5.c26
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-6.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-7.c30
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-8.c31
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-9.c17
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c40
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c52
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-3.c39
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-4.c68
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-5.c20
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c34
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c42
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-8.c41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-9.c44
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa.exp35
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-1.c61
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-2.c80
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-1.c52
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-2.c99
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-3.c70
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-4.c68
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c37
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c43
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c44
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c62
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c68
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c75
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c54
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c52
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c45
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-ii-1.c34
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/noclone-1.c29
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr42706.c27
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr45644.c36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr48195.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr50744.c119
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr51362.c22
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr55260.c38
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr56988.c38
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57294.c18
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57347.c27
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57358.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57539.c218
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr58106.c50
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr58492.c7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr59008.c32
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr59610.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-1.c80
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-2.c30
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-0.c30
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-1a.c34
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-1b.c37
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-2a.c90
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-2b.c94
91 files changed, 4196 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c
new file mode 100644
index 0000000..bb8e7af
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-cgraph" } */
+static __attribute__((constructor))
+void empty_constructor()
+{
+}
+/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "cgraph" } } */
+/* { dg-final { cleanup-ipa-dump "cgraph" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-1.c
new file mode 100644
index 0000000..860b3e5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-1.c
@@ -0,0 +1,27 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */
+
+extern void non_existent(int);
+
+static void hooray ()
+{
+ non_existent (1);
+}
+
+static void hiphip (void (*f)())
+{
+ non_existent (2);
+ f ();
+}
+
+int test (void)
+{
+ hiphip (hooray);
+ 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-4.9/gcc/testsuite/gcc.dg/ipa/iinline-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-2.c
new file mode 100644
index 0000000..117818d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-2.c
@@ -0,0 +1,41 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */
+
+extern void non_existent(int);
+
+int __attribute__ ((noinline,noclone)) get_input(void)
+{
+ return 1;
+}
+
+static void hooray ()
+{
+ non_existent (1);
+}
+
+static void hip2 (void (*g)())
+{
+ non_existent (2);
+ g ();
+}
+
+static void hip1 (void (*f)(void (*)()), void (*g)())
+{
+ non_existent (2);
+ f (g);
+}
+
+int main (int argc, int *argv[])
+{
+ int i;
+
+ for (i = 0; i < get_input (); i++)
+ hip1 (hip2, hooray);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "hooray\[^\\n\]*inline copy in main" "inline" } } */
+/* { dg-final { scan-ipa-dump "hip2\[^\\n\]*inline copy in main" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-3.c
new file mode 100644
index 0000000..b399571
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-3.c
@@ -0,0 +1,33 @@
+/* Verify that call declarations are not redirected according to indirect
+ inlining edges too early. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining" } */
+
+extern void abort (void);
+
+int bar (int k)
+{
+ return k+2;
+}
+
+int baz (int k)
+{
+ return k+1;
+}
+
+static int foo (int (*p)(int), int i)
+{
+ return p (i+1);
+}
+
+int (*g)(int) = baz;
+
+int main (int argc, char *argv[])
+{
+ if (foo (bar, 0) != 3)
+ abort ();
+ if (foo (g, 1) != 3)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-4.c
new file mode 100644
index 0000000..71faae2
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/iinline-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-5.c
new file mode 100644
index 0000000..8fb47ca
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/iinline-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-6.c
new file mode 100644
index 0000000..5a9b759
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/iinline-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/iinline-7.c
new file mode 100644
index 0000000..c95d374
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/inline-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-1.c
new file mode 100644
index 0000000..c662682
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-1.c
@@ -0,0 +1,37 @@
+/* Verify that analysis of function parameters works as expected. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline" } */
+struct bah {int a,b,c,d,e;};
+static struct bah bah3={2,3,4,5,6};
+const static struct bah bah4={2,3,4,5,6};
+void test (int, struct bah *, struct bah, struct bah, int, struct bah, struct bah, struct bah);
+void foo (int invariant, struct bah invariant2)
+{
+ int i;
+ struct bah bah2={1,2,3,4,5};
+ struct bah bah5={1,2,3,4,5};
+ for (i = 0; i<10; i++)
+ {
+ bah5.a=i;
+ test (i, &bah2, bah2, bah3, invariant, invariant2, bah4, bah5);
+ }
+}
+/* op0 change on every invocation. */
+/* op1 is function invariant. */
+/* { dg-final { scan-ipa-dump-not "op0 is compile time invariant" "inline" } } */
+/* { dg-final { scan-ipa-dump-not "op0 change" "inline" } } */
+/* { dg-final { scan-ipa-dump "op1 is compile time invariant" "inline" } } */
+/* op2 is invariant within loop (we make assumption that function call does not afect it.). */
+/* { dg-final { scan-ipa-dump "op2 change 10.000000. of time" "inline" } } */
+/* op3 is invariant within loop (we make assumption that function call does not afect it.). */
+/* { dg-final { scan-ipa-dump "op3 change 10.000000. of time" "inline" } } */
+/* op4 is invariant within loop. */
+/* { dg-final { scan-ipa-dump "op4 change 10.000000. of time" "inline" } } */
+/* op5 is invariant within loop. */
+/* { dg-final { scan-ipa-dump "op5 change 10.000000. of time" "inline" } } */
+/* op6 is compile time invariant. */
+/* { dg-final { scan-ipa-dump "op6 is compile time invariant" "inline" } } */
+/* op7 change. */
+/* { dg-final { scan-ipa-dump-not "op7 is compile time invariant" "inline" } } */
+/* { dg-final { scan-ipa-dump-not "op7 change" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-2.c
new file mode 100644
index 0000000..376cf97
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-2.c
@@ -0,0 +1,33 @@
+/* Verify that logic combining probabilities works as expected. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline -fno-early-inlining" } */
+
+struct bah {int a,b,d;};
+
+__attribute__ ((noinline))
+void test(int a,int b,int c,int d,int e)
+{
+ test3(a,b,c,d,e);
+}
+inline
+static void bar (int parm1, int parm2)
+{
+ int i;
+ for (i = 0; i<10; i++)
+ {
+ test (0,0,parm1,parm2,i);
+ }
+}
+void foo (int invariant)
+{
+ int i;
+ for (i = 0; i<10; i++)
+ {
+ bar (i, invariant);
+ }
+}
+/* After inlining bar into foo, op2 is invariant within inner loop. */
+/* { dg-final { scan-ipa-dump "op2 change 10.000000. of time" "inline" } } */
+/* After inlining bar into foo, op3 is invariant within both loops. */
+/* { dg-final { scan-ipa-dump "op3 change 1.000000. of time" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-3.c
new file mode 100644
index 0000000..d97f0c6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-3.c
@@ -0,0 +1,25 @@
+/* Verify that do_work is detected as being loop invariant. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining" } */
+
+struct bah {int a,b,d;};
+
+static int do_work (struct bah s)
+{
+ return s.a*s.b/s.d;
+}
+int foo (int invariant)
+{
+ int i;
+ struct bah s = {invariant,invariant,invariant};
+ int sum = 0;
+ for (i = 0; i<10; i++)
+ {
+ sum += do_work (s);
+ }
+ return sum;
+}
+
+
+/* { dg-final { scan-ipa-dump "Scaling time by probability:0.100000" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-4.c
new file mode 100644
index 0000000..66019b3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-4.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -c -fdump-ipa-inline -fno-early-inlining -fno-partial-inlining -fno-ipa-cp" } */
+
+void do_something (int shall_i_work)
+{
+ if (shall_i_work)
+ {
+ work_hard ();
+ work_hard ();
+ work_hard ();
+ work_hard ();
+ work_hard ();
+ work_hard ();
+ work_hard ();
+ work_hard ();
+ }
+}
+int foo (int invariant)
+{
+ do_something (0);
+ do_something (1);
+}
+
+
+/* We should inline do_something(0), but not do_something (1). */
+/* { dg-final { scan-ipa-dump "Inlined 1 calls, eliminated 0 functions" "inline" } } */
+/* Call to work_hard should be detected as optimized out. */
+/* { dg-final { scan-ipa-dump-times "predicate: .false." 8 "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-5.c
new file mode 100644
index 0000000..d4b7410
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-5.c
@@ -0,0 +1,36 @@
+/* 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" } */
+struct a {int a,b,c,d,e;};
+
+void
+accessfield (struct a a)
+{
+ t(a.a);
+ /* Should compile as:
+ tmp = a.a
+ Will be eliminated by inlining
+ t (tmp); */
+ t2(&a);
+ t(a.a);
+ return;
+ /* Will be eliminated by inlining */
+}
+void
+accessreference (struct a *a)
+{
+ t(a->a);
+ /* Should compile as:
+ a.0_1 = a;
+ Will be eliminated by inlining
+ tmp = a.0_1->a;
+ 50% will be eliminated by inlining
+ t (tmp) */
+ t2(&a);
+ return;
+ /* Will be eliminated by inlining */
+}
+
+/* { dg-final { scan-ipa-dump-times "Will be eliminated" 4 "inline" { xfail { { hppa*-*-* } && { ! lp64 } } } } } */
+/* { dg-final { scan-ipa-dump-times "50. will be eliminated" 1 "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inline-6.c
new file mode 100644
index 0000000..d981bb0
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c
new file mode 100644
index 0000000..9810e25
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c
new file mode 100644
index 0000000..a06d725
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c
new file mode 100644
index 0000000..110ae44
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipa-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-1.c
new file mode 100644
index 0000000..3cc32da
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+#include <stdio.h>
+int g (int b, int c)
+{
+ printf ("%d %d\n", b, c);
+}
+int f (int a)
+{
+ /* Second parameter of g gets different values. */
+ if (a > 0)
+ g (a, 3);
+ else
+ g (a, 5);
+}
+int main ()
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-2.c
new file mode 100644
index 0000000..7f14d42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-2.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+#include <stdio.h>
+int g (int b, int c)
+{
+ printf ("%d %d\n", b, c);
+}
+int f (int a)
+{
+ /* a is modified. */
+ if (a++ > 0)
+ g (a, 3);
+}
+int main ()
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-3.c
new file mode 100644
index 0000000..36fd506
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-3.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+
+/* Double constants. */
+
+#include <stdio.h>
+void t(void);
+static int g (double b, double c)
+{
+ t();
+ return (int)(b+c);
+}
+static int f (double a)
+{
+ if (a > 0)
+ g (a, 3.1);
+ else
+ g (a, 3.1);
+}
+int main ()
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7.44);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "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 .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-4.9/gcc/testsuite/gcc.dg/ipa/ipa-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-4.c
new file mode 100644
index 0000000..566b329
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-4.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+#include <stdio.h>
+int g (int b, int c)
+{
+ printf ("%d %d\n", b, c);
+}
+int f (int a)
+{
+ /* First and second parameter of g gets different values. */
+
+ if (a > 0)
+ g (a, 3);
+ else
+ g (a+1, 5);
+}
+int main ()
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "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-4.9/gcc/testsuite/gcc.dg/ipa/ipa-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-5.c
new file mode 100644
index 0000000..daa64fa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-5.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+/* Float & short constants. */
+
+#include <stdio.h>
+int t(void);
+int g (float b, short c)
+{
+ t();
+ return c + (int)b;
+}
+int f (float a)
+{
+ int i, j = t();
+ /* a is modified. */
+ if (a++ > 0)
+ for (i = 0; i < j; i++)
+ g (a, 3);
+}
+int main ()
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7.6);
+ return 0;
+}
+
+/* { 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-4.9/gcc/testsuite/gcc.dg/ipa/ipa-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-6.c
new file mode 100644
index 0000000..c7d9b37
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-6.c
@@ -0,0 +1,33 @@
+/* PR middle-end/29122 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fno-early-inlining" } */
+
+int
+dont_inline (int);
+
+int
+bar (int b, int c)
+{
+ return dont_inline (c);
+}
+
+int
+foo (int a)
+{
+ if (a++ > 0)
+ bar (a, 3);
+
+ foo (7);
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ foo (7);
+ return 0;
+}
+
+
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-7.c
new file mode 100644
index 0000000..271a34a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-7.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+#include <stdio.h>
+void send_addr (int *);
+int g (int b, int c)
+{
+ printf ("%d %d\n", b, c);
+}
+int f (int a)
+{
+ if (a > 0)
+ g (a, 3);
+ else
+ g (a, 5);
+
+ send_addr (&a);
+}
+int main ()
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7);
+ return 0;
+}
+
+
+/* { 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 { cleanup-ipa-dump "cp" } } */
+
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-8.c
new file mode 100644
index 0000000..d138cf2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-8.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+#include <stdio.h>
+static int g (int b, int c)
+{
+ printf ("%d %d\n", b, c);
+}
+static int f (int a)
+{
+ /* Second parameter of g gets different values. */
+ if (a > 0)
+ g (a, 3);
+ else
+ g (a, 5);
+}
+int main ()
+{
+ f (7);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "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 .0 b with const 7" "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-1.c
new file mode 100644
index 0000000..a56e71a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-1.c
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-options "-O -fipa-pta -fdump-ipa-pta-details" } */
+
+static int __attribute__((noinline))
+foo (int *p, int *q)
+{
+ *p = 2;
+ *q = 1;
+ return *p;
+}
+
+static int __attribute__((noinline))
+bar (int *p, int *q)
+{
+ *p = -2;
+ *q = -1;
+ return *p;
+}
+
+static int __attribute__((noinline,noclone))
+foobar (int foo_p)
+{
+ int a;
+ int (*fn)(int *, int *);
+ if (foo_p)
+ fn = foo;
+ else
+ fn = bar;
+ return (*fn)(&a, &a);
+}
+
+extern void abort (void);
+
+int main()
+{
+ if (foobar (1) != 1)
+ abort ();
+
+ return 0;
+}
+
+/* IPA PTA needs to handle indirect calls properly. Verify that
+ both bar and foo get a (and only a) in their arguments points-to sets. */
+
+/* { dg-final { scan-ipa-dump "fn_1 = { bar foo }" "pta" } } */
+/* { dg-final { scan-ipa-dump "bar.arg0 = { a }" "pta" } } */
+/* { dg-final { scan-ipa-dump "bar.arg1 = { a }" "pta" } } */
+/* { dg-final { scan-ipa-dump "foo.arg0 = { a }" "pta" } } */
+/* { dg-final { scan-ipa-dump "foo.arg1 = { a }" "pta" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-10.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-10.c
new file mode 100644
index 0000000..81a3c53
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-10.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details" } */
+
+#include <stdarg.h>
+
+static void __attribute__((noinline,noclone))
+foo (int i, ...)
+{
+ va_list ap;
+ int *p;
+ va_start (ap, i);
+ p = va_arg (ap, int *);
+ *p = 1;
+ va_end (ap);
+}
+extern void abort (void);
+int main()
+{
+ int i = 0;
+ foo (0, &i);
+ if (i != 1)
+ abort ();
+ return 0;
+}
+
+/* Verify we properly handle variadic arguments and do not let escape
+ stuff through it. */
+
+/* { dg-final { scan-ipa-dump "ESCAPED = { (ESCAPED )?(NONLOCAL )?}" "pta" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-11.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-11.c
new file mode 100644
index 0000000..dadb166
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-11.c
@@ -0,0 +1,36 @@
+/* { dg-do link } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details" } */
+
+static int i;
+/* i should not escape here, p should point to i only. */
+/* { dg-final { scan-ipa-dump "p = { i }" "pta" } } */
+static int *p = &i;
+
+int j;
+/* q should point to j only. */
+/* { dg-final { scan-ipa-dump "q = { j }" "pta" } } */
+static int *q = &j;
+
+static int k;
+/* k should escape here, r should point to NONLOCAL, ESCAPED, k. */
+int *r = &k;
+/* { dg-final { scan-ipa-dump "r = { ESCAPED NONLOCAL k }" "pta" } } */
+
+int l;
+/* s should point to NONLOCAL, ESCAPED, l. */
+int *s = &l;
+/* { dg-final { scan-ipa-dump "s = { ESCAPED NONLOCAL l }" "pta" } } */
+
+/* Make p and q referenced so they do not get optimized out. */
+int foo() { return &p < &q; }
+
+int main()
+{
+ return 0;
+}
+
+/* It isn't clear if the escape if l is strictly necessary, if it were
+ we should have i, r and s in ESCAPED as well. */
+
+/* { dg-final { scan-ipa-dump "ESCAPED = { ESCAPED NONLOCAL l k }" "pta" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-12.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-12.c
new file mode 100644
index 0000000..1c773ee
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-12.c
@@ -0,0 +1,34 @@
+static int i, j;
+
+static void __attribute__((noinline,noclone))
+foo (void) { i = 1; }
+
+static void __attribute__((noinline,noclone))
+bar (void) { j = 1; }
+
+typedef void (*fn_t)(void);
+void escapeme (fn_t);
+fn_t getme (void);
+
+extern void link_error (void);
+
+int main()
+{
+ fn_t fn;
+ escapeme (foo);
+ fn = getme();
+
+ i = 0;
+ fn();
+ if (i != 1)
+ return 100;
+ j = 0;
+ fn();
+ if (j != 0)
+ link_error ();
+ bar();
+ if (j != 1)
+ return 200;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
new file mode 100644
index 0000000..0f46e98
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
@@ -0,0 +1,62 @@
+/* { dg-do link } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details -fdump-tree-fre2" } */
+
+static int x, y;
+
+static __attribute__((noinline,noclone)) void
+local (int *p)
+{
+ *p = 1;
+}
+
+static __attribute__((noinline,noclone)) void
+local_address_taken (int *p)
+{
+ *p = 1;
+}
+
+void *anyfn_global;
+
+/* Even though not referenced in this TU we should have added constraints
+ for the initializer. */
+/* { dg-final { scan-ipa-dump "ex = &local_address_taken" "pta" } } */
+void (*ex)(int *) = local_address_taken;
+
+extern void link_error (void);
+
+int main()
+{
+ void (*anyfn)(int *) = (void (*)(int *))(__SIZE_TYPE__)anyfn_global;
+ /* The following should cause local_address_taken to get &x
+ as argument, but not local. We shouldn't get &x added to
+ arbitrary special sub-vars of local_address_taken though,
+ a missed optimization currently.
+ As local_address_taken escapes the translation unit its
+ argument points-to set needs to include ESCAPED and NONLOCAL.
+ We shouldn't get the functions sub-vars in the ESCAPED solution
+ though, another missed-optimization. This also causes the functions
+ uses to be messed up even further. */
+ /* ??? As we don't expand the ESCAPED solution we either get x printed here
+ or not based on the phase of the moon. */
+ /* { dg-final { scan-ipa-dump "local_address_taken.arg0 = { ESCAPED NONLOCAL y x }" "pta" { xfail *-*-* } } } */
+ /* { dg-final { scan-ipa-dump "local_address_taken.clobber = { ESCAPED NONLOCAL y x }" "pta" { xfail *-*-* } } } */
+ /* { dg-final { scan-ipa-dump "local_address_taken.use = { }" "pta" { xfail *-*-* } } } */
+ /* ??? But make sure x really escaped. */
+ /* { dg-final { scan-ipa-dump "ESCAPED = {\[^\n\}\]* x \[^\n\}\]*}" "pta" } } */
+ (*anyfn) (&x);
+ x = 0;
+ local (&y);
+ /* Thus we should be able to disambiguate x against the call to local
+ and CSE the stored value. */
+ if (x != 0)
+ link_error ();
+ x = 1;
+ local_address_taken (&y);
+ /* As we are computing flow- and context-insensitive we may not
+ CSE the load of x here. */
+ /* { dg-final { scan-tree-dump " = x;" "fre2" } } */
+ return x;
+}
+
+/* { dg-final { cleanup-ipa-dump "pta" } } */
+/* { dg-final { cleanup-tree-dump "fre2" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c
new file mode 100644
index 0000000..b62b08f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta -fno-tree-fre -fno-tree-sra -fdump-ipa-pta-details" } */
+
+struct X {
+ int i;
+ void *p;
+};
+
+static void * __attribute__((noinline,noclone))
+foo(struct X *q, void *p)
+{
+ struct X b;
+ b.p = p;
+ *q = b;
+ return q->p;
+}
+extern void abort (void);
+int main()
+{
+ struct X a, c;
+ void *p;
+ a.p = (void *)&c;
+ p = foo(&a, &a);
+ /* { 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 ();
+ return 0;
+}
+
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-15.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-15.c
new file mode 100644
index 0000000..77701eb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-15.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta" } */
+
+struct Foo {
+ int *p;
+ int *q;
+};
+
+void __attribute__((noinline))
+bar (int **x)
+{
+ struct Foo *f = (struct Foo *)(x - 1);
+ *(f->p) = 0;
+}
+
+int foo(void)
+{
+ struct Foo f;
+ int i = 1, j = 2;
+ f.p = &i;
+ f.q = &j;
+ bar(&f.q);
+ return i;
+}
+
+extern void abort (void);
+int main()
+{
+ if (foo () != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c
new file mode 100644
index 0000000..ef41826
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-16.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-tree-sra -fipa-pta -fdump-ipa-pta" } */
+
+struct X
+{
+ long l1;
+ struct Y
+ {
+ long l2;
+ int *p;
+ } y;
+};
+int i;
+static int __attribute__((noinline))
+foo (struct X *x)
+{
+ struct Y y = x->y;
+ *y.p = 0;
+ i = 1;
+ return *y.p;
+}
+extern void abort (void);
+int main()
+{
+ struct X x;
+ x.y.p = &i;
+ if (foo(&x) != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "y.\[0-9\]*\\\+\[0-9\]* = { i }" "pta" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c
new file mode 100644
index 0000000..443ed9d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-17.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-require-alias "" } */
+/* { dg-options "-O -fipa-pta" } */
+
+static int i;
+extern int j __attribute__ ((alias ("i")));
+int *p = &j;
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-2.c
new file mode 100644
index 0000000..a6c7e4b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-2.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fipa-pta -fdump-ipa-pta-details" } */
+
+int (*fn)(int *);
+
+static int __attribute__((noinline,noclone))
+foo (int *p)
+{
+ return *p;
+}
+
+extern void bar (void);
+
+int main()
+{
+ fn = foo;
+ bar ();
+ return 0;
+}
+
+/* Make sure that when a local function escapes its argument points-to sets
+ are properly adjusted. */
+
+/* { dg-final { scan-ipa-dump "foo.arg0 = { ESCAPED NONLOCAL }" "pta" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c
new file mode 100644
index 0000000..4790080
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-3.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details -fdump-tree-fre2-details" } */
+
+static int __attribute__((noinline,noclone))
+foo (int *p, int *q)
+{
+ *p = 1;
+ *q = 0;
+ return *p;
+}
+
+extern void abort (void);
+
+int main()
+{
+ int a, b;
+ if (foo (&a, &b) != 1)
+ abort ();
+ return 0;
+}
+
+/* Verify we can disambiguate *p and *q in foo. */
+
+/* { 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_2\\\(D\\\) with 1" "fre2" } } */
+/* { dg-final { cleanup-tree-dump "fre2" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c
new file mode 100644
index 0000000..bf6fa28
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-4.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details -fdump-tree-fre2-details" } */
+
+int a, b;
+
+static int __attribute__((noinline,noclone))
+foo (int *p, int *q)
+{
+ int res;
+ *p = 1;
+ *q = 0;
+ res = *p;
+ a = 1;
+ b = 1;
+ return res;
+}
+
+extern void abort (void);
+
+int main()
+{
+ if (foo (&a, &b) != 1)
+ abort ();
+ return 0;
+}
+
+/* Verify we can disambiguate *p and *q in foo. */
+
+/* { 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_2\\\(D\\\) with 1" "fre2" } } */
+/* { dg-final { cleanup-tree-dump "fre2" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-5.c
new file mode 100644
index 0000000..3359c53
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-5.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details" } */
+
+int **x;
+
+static int __attribute__((noinline,noclone))
+foo (int **q)
+{
+ int a = 1;
+ **q = 0;
+ *x = &a;
+ return **q;
+}
+
+extern void abort (void);
+int main()
+{
+ int b;
+ int *p = &b;
+ x = &p;
+ if (foo (&p) != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-6.c
new file mode 100644
index 0000000..aaa6090
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-6.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O -fipa-pta -fdump-ipa-pta-details" } */
+
+static void __attribute__((noinline,noclone))
+foo (int *p)
+{
+ *p = 1;
+}
+
+extern void abort (void);
+
+int main()
+{
+ int i = 0;
+ foo (&i);
+ if (i != 1)
+ abort ();
+ return 0;
+}
+
+/* Verify we correctly compute the units ESCAPED set as empty but
+ still properly account for the store via *p in foo. */
+
+/* { dg-final { scan-ipa-dump "ESCAPED = { }" "pta" } } */
+/* { dg-final { cleanup-ipa-dump "pta" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-7.c
new file mode 100644
index 0000000..3cdfd63
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-7.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-early-inlining -fipa-pta" } */
+
+static void __attribute__((noinline,noclone))
+clobber_me (int *p, int how)
+{
+ *p = how;
+}
+
+/* When foo is inlined into main we have to make sure to adjust
+ main()s IPA CLOBBERED set according to the decl remappings
+ inlining does. */
+
+static int
+foo (void)
+{
+ int a = 0;
+ clobber_me (&a, 1);
+ return a;
+}
+
+extern void abort (void);
+
+int main()
+{
+ if (foo () != 1)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-8.c
new file mode 100644
index 0000000..5bedc9d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-8.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-early-inlining -fipa-pta" } */
+
+static int *__attribute__((noinline,noclone))
+pass_me (int *p)
+{
+ return p;
+}
+
+/* When foo is inlined into main we have to make sure to adjust
+ main()s IPA CLOBBERED set according to the decl remappings
+ inlining does. */
+
+static int
+foo (void)
+{
+ int a = 0;
+ int *p = pass_me (&a);
+ *p = 1;
+ return a;
+}
+
+extern void abort (void);
+
+int main()
+{
+ if (foo () != 1)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-9.c
new file mode 100644
index 0000000..1a98da3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-pta-9.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-pta" } */
+
+static void __attribute__((noinline,noclone))
+foo (int *p, int *q)
+{
+ __builtin_memcpy (p, q, sizeof (int));
+}
+extern void abort (void);
+int main()
+{
+ int i = 0, j = 1;
+ foo (&i, &j);
+ if (i != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
new file mode 100644
index 0000000..2c05347
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+
+struct bovid
+{
+ float red;
+ int green;
+ void *blue;
+};
+
+extern int printf (const char *, ...);
+extern void abort (void);
+
+static int
+__attribute__((noinline))
+ox (struct bovid cow)
+{
+ if (cow.green != 6)
+ abort ();
+
+ printf ("green: %f\nblue: %p\nblue again: %p\n", cow.green,
+ cow.blue, cow.blue);
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ struct bovid cow;
+
+ cow.red = 7.4;
+ cow.green = 6;
+ cow.blue = &cow;
+
+ ox (cow);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "About to replace expr" 2 "eipa_sra" } } */
+/* { dg-final { cleanup-tree-dump "eipa_sra" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
new file mode 100644
index 0000000..3437a81
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+
+struct bovid
+{
+ float red;
+ int green;
+ void *blue;
+};
+
+static int
+__attribute__((noinline))
+ox (struct bovid *cow)
+{
+ cow->red = cow->red + cow->green + cow->green;
+ return 0;
+}
+
+int something;
+
+static int
+__attribute__((noinline))
+ox_improved (struct bovid *calf)
+{
+ if (something > 0)
+ calf->red = calf->red + calf->green;
+ else
+ calf->red = calf->green + 87;
+ something = 77;
+ return 0;
+}
+
+
+int main (int argc, char *argv[])
+{
+ struct bovid cow;
+
+ cow.red = 7.4;
+ cow.green = 6;
+ cow.blue = &cow;
+
+ ox (&cow);
+
+ ox_improved (&cow);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "About to replace expr cow_.*D.->red with \\*ISRA" "eipa_sra" } } */
+/* { dg-final { scan-tree-dump "About to replace expr cow_.*D.->green with ISRA" "eipa_sra" } } */
+/* { dg-final { scan-tree-dump "About to replace expr calf_.*D.->red with \\*ISRA" "eipa_sra" } } */
+/* { dg-final { scan-tree-dump "About to replace expr calf_.*D.->green with ISRA" "eipa_sra" } } */
+/* { dg-final { cleanup-tree-dump "eipa_sra" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-3.c
new file mode 100644
index 0000000..ac078c2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-3.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+
+struct bovid
+{
+ float red;
+ int green;
+ void *blue;
+};
+
+extern void foo (float, void *, void *, long);
+
+static int
+__attribute__((noinline))
+ox (struct bovid cow, int z, struct bovid calf, long l)
+{
+ foo (cow.red, cow.blue, cow.blue, l);
+ return 0;
+}
+
+void caller (void)
+{
+ struct bovid cow, calf;
+
+ cow.red = 7.4;
+ cow.green = 6;
+ cow.blue = &cow;
+
+ calf.red = 8.4;
+ calf.green = 5;
+ calf.blue = &cow;
+
+ ox (cow,4,calf,2);
+ return;
+}
+
+/* { dg-final { scan-tree-dump "base: z, remove_param" "eipa_sra" } } */
+/* { dg-final { scan-tree-dump "base: calf, remove_param" "eipa_sra" } } */
+/* { dg-final { cleanup-tree-dump "eipa_sra" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-4.c
new file mode 100644
index 0000000..f07706b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-4.c
@@ -0,0 +1,68 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+
+static int
+__attribute__((noinline))
+ox (int *i)
+{
+ return *i+4**i;
+}
+
+int *holder;
+
+static int
+__attribute__((noinline))
+ox_ctrl_1 (int *j)
+{
+ holder = j;
+ return *j+4 * *j+1;
+}
+
+static void
+__attribute__((noinline))
+ox_ctrl_2 (int *k)
+{
+ *k = 8;
+}
+
+static int zzz[10];
+
+static int
+__attribute__((noinline))
+ox_improved (int recurse, int *l)
+{
+ int r = 0;
+
+ r = *l;
+
+ if (recurse)
+ {
+ if (recurse > 2)
+ l = &zzz[3];
+ else
+ l = zzz;
+
+ ox_improved (0, l);
+ }
+
+ return r;
+}
+
+void caller (void)
+{
+ int a = 1;
+ int b = 10;
+ int c;
+
+ ox (&a);
+ ox_ctrl_1 (&a);
+ ox_ctrl_2 (&a);
+ *holder = ox_improved (1, &b);
+ return;
+}
+
+/* { dg-final { scan-tree-dump "About to replace expr \\*i_.*D. with ISRA" "eipa_sra" } } */
+/* { dg-final { scan-tree-dump "About to replace expr \\*l_.*D. with ISRA" "eipa_sra" } } */
+/* { dg-final { scan-tree-dump-times "About to replace expr \*j_.*D. with ISRA" 0 "eipa_sra" } } */
+/* { dg-final { scan-tree-dump-times "About to replace expr \*k_.*D. with ISRA" 0 "eipa_sra" } } */
+/* { dg-final { cleanup-tree-dump "eipa_sra" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-5.c
new file mode 100644
index 0000000..2fe4ee7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-5.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+
+static int *
+__attribute__((noinline,used))
+ ox (int *i, int *j)
+{
+ return i;
+}
+
+int a;
+
+int *caller (void)
+{
+ int b = 10;
+
+ return ox (&a, &b);
+}
+/* { dg-final { scan-tree-dump-times "base: j, remove_param" 0 "eipa_sra" } } */
+/* { dg-final { cleanup-tree-dump "eipa_sra" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c
new file mode 100644
index 0000000..487e72e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-slim" } */
+/* { dg-require-effective-target non_strict_align } */
+
+struct bovid
+{
+ float a;
+ int b;
+ struct bovid *next;
+};
+
+static int
+__attribute__((noinline))
+foo (struct bovid *cow, int i)
+{
+ i++;
+ if (cow->next)
+ foo (cow->next, i);
+ return i;
+}
+
+int main (int argc, char *argv[])
+{
+ struct bovid cow;
+
+ cow.a = 7.4;
+ cow.b = 6;
+ cow.next = (struct bovid *) 0;
+
+ return foo (&cow, 0);
+}
+
+/* { dg-final { scan-tree-dump-times "foo " 1 "eipa_sra" } } */
+/* { dg-final { cleanup-tree-dump "eipa_sra" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-7.c
new file mode 100644
index 0000000..921334a
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-8.c
new file mode 100644
index 0000000..9e6e40a
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa-sra-9.c
new file mode 100644
index 0000000..c5468cf
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipa.exp b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa.exp
new file mode 100644
index 0000000..3c3c600
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipa.exp
@@ -0,0 +1,35 @@
+# 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-1.c
new file mode 100644
index 0000000..4fce41e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-1.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fipa-cp -fdump-ipa-cp -fno-early-inlining -fdump-tree-optimized" } */
+
+int array[100];
+
+int t(int);
+
+static int
+i_can_be_propagated_fully (int *a)
+{
+ int i;
+ for (i=0;i<50;i++)
+ {
+ t(a[i]);
+ t(a[i+1]);
+ t(a[i+2]);
+ t(a[i+3]);
+ }
+}
+static int
+i_can_be_propagated_fully2 (int *a)
+{
+ i_can_be_propagated_fully (a);
+ i_can_be_propagated_fully (a);
+ i_can_be_propagated_fully (a);
+}
+static int
+i_can_not_be_propagated_fully (int *a)
+{
+ int i;
+ for (i=0;i<50;i++)
+ {
+ t(a[i]);
+ t(a[i+1]);
+ t(a[i+2]);
+ t(a[i+3]);
+ }
+}
+int
+i_can_not_be_propagated_fully2 (int *a)
+{
+ i_can_not_be_propagated_fully (a);
+ i_can_not_be_propagated_fully (a);
+ i_can_not_be_propagated_fully (a);
+}
+main()
+{
+ i_can_be_propagated_fully2 (array);
+ i_can_be_propagated_fully2 (array);
+ i_can_not_be_propagated_fully2 (array);
+ i_can_not_be_propagated_fully2 (array);
+}
+
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully2" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully/" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully2" "cp" } } */
+/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully/" "cp" } } */
+/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully " "optimized" } } */
+/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully2 " "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
new file mode 100644
index 0000000..ceb524e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
@@ -0,0 +1,80 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining -fdump-tree-optimized" } */
+/* { dg-add-options bind_pic_locally } */
+
+int array[100];
+
+int t(int);
+
+static int
+i_can_be_propagated_fully (int *a)
+{
+ int i;
+ for (i=0;i<50;i++)
+ {
+ t(a[i]);
+ t(a[i+1]);
+ t(a[i+2]);
+ t(a[i+3]);
+ }
+}
+static int
+i_can_be_propagated_fully2 (int *a)
+{
+ i_can_be_propagated_fully (a);
+ i_can_be_propagated_fully (a);
+ i_can_be_propagated_fully (a);
+}
+static int
+i_can_not_be_propagated_fully (int *a)
+{
+ int i;
+ for (i=0;i<50;i++)
+ {
+ t(a[i]);
+ t(a[i+1]);
+ t(a[i+2]);
+ t(a[i+3]);
+ }
+}
+int
+i_can_not_be_propagated_fully2 (int *a)
+{
+ int i;
+ i_can_not_be_propagated_fully (a);
+ for (i=0;i<50;i++)
+ {
+ t(a[i] + 1);
+ t(a[i+1] + 1);
+ t(a[i+2] + 1);
+ t(a[i+3] + 1);
+ }
+ i_can_not_be_propagated_fully (a);
+ for (i=0;i<50;i++)
+ {
+ t(a[i] + 2);
+ t(a[i+1] + 2);
+ t(a[i+2] + 2);
+ t(a[i+3] + 2);
+ }
+ i_can_not_be_propagated_fully (a);
+}
+main()
+{
+ int i;
+ i_can_be_propagated_fully2 (array);
+ i_can_be_propagated_fully2 (array);
+
+ for (i = 0; i < 7; i++)
+ i_can_not_be_propagated_fully2 (array);
+ i_can_not_be_propagated_fully2 (array);
+}
+
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully2" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully/" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully2" "cp" } } */
+/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully/" "cp" } } */
+/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully \\(" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully2 \\(" "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
new file mode 100644
index 0000000..a2ffd42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
@@ -0,0 +1,52 @@
+/* Test that IPA-CP is able to figure out that poth parameters a are constant 7
+ even though f and h recursively call each other and specialize them
+ accordinly. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+extern void use_stuff (int);
+
+static
+int g (int b, int c)
+{
+ int i;
+
+ for (i = 0; i < b; i++)
+ use_stuff (c);
+}
+
+static void f (int a, int x, int z);
+
+static void h (int z, int a)
+{
+ use_stuff (z);
+ f (a, 9, 10);
+
+}
+
+static void
+f (int a, int x, int z)
+{
+ if (z > 1)
+ g (a, x);
+ else
+ h (5, a);
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7, 8, argc);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of f.*for all known contexts" "cp" } } */
+/* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
new file mode 100644
index 0000000..62f564f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
@@ -0,0 +1,99 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+extern int get_stuff (int);
+extern void do_stuff (int);
+extern void do_stuff2 (int);
+extern void do_other_stuff (void);
+extern int get_element (int, int, int);
+extern int adjust (int, int, int, int);
+
+extern int count;
+
+int
+foo (int s, int p)
+{
+ int c, r = 0;
+
+ for (c = 0 ; c < count; c++)
+ {
+ r += get_stuff (s);
+ /* The following is just something big that can go away. */
+ if (p != 0)
+ {
+ int a[64][64];
+ int i, j, k;
+
+ for (i = 0; i < 64; i++)
+ for (j = 0; j < 64; j++)
+ a[i][j] = get_element (p + c, i, j);
+
+ for (k = 0; k < 4; k++)
+ {
+ r = r / 2;
+
+ for (i = 1; i < 63; i++)
+ for (j = 62; j > 0; j--)
+ a[i][j] += adjust (a[i-1][j], a[i][j-1],
+ a[i+1][j], a[i][j+1]);
+
+ for (i = 4; i < 64; i += 4)
+ for (j = 4; j < 64; j += 4)
+ r += a[i][j] / 4;
+ }
+ }
+ }
+ return r;
+}
+
+int
+bar (int p, int q)
+{
+ if (q > 0)
+ do_stuff (q);
+ else
+ do_stuff (-q);
+
+ if (q % 2)
+ do_stuff2 (2 * q);
+ else
+ do_stuff2 (2 * (q + 1));
+
+ return foo (4, p);
+}
+
+int
+bah (int p, int q)
+{
+ int i, j;
+
+ while (q < -20)
+ q += get_stuff (-q);
+
+ for (i = 0; i < 36; i++)
+ for (j = 0; j < 36; j++)
+ do_stuff (get_stuff (q * i + 2));
+
+ bar (p, q);
+}
+
+int
+top1 (int q)
+{
+ do_other_stuff ();
+ return bah (0, q);
+}
+
+int
+top2 (int q)
+{
+ do_stuff (200);
+ do_other_stuff ();
+ return bah (16, 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 .0 s with const 4" "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-3.c
new file mode 100644
index 0000000..af4f50b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-3.c
@@ -0,0 +1,70 @@
+/* Verify that IPA-CP can clone mark_cell without miscompiling it despite its
+ type_attributes. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-ipa-cp" } */
+
+
+struct PMC {
+ unsigned flags;
+};
+
+typedef struct Pcc_cell
+{
+ struct PMC *p;
+ long bla;
+ long type;
+} Pcc_cell;
+
+int gi;
+
+extern void abort ();
+extern void never_ever(int * interp, struct PMC *pmc)
+ __attribute__((noinline));
+
+void never_ever (int * interp, struct PMC *pmc)
+{
+ abort ();
+}
+
+static void mark_cell(int * interp, Pcc_cell *c)
+ __attribute__((__nonnull__(1)))
+ __attribute__((noinline));
+
+static void
+mark_cell(int * interp, Pcc_cell *c)
+{
+ if (c && c->type == 4 && c->p
+ && !(c->p->flags & (1<<14)))
+ never_ever(interp, c->p);
+}
+
+static void foo(int * interp, Pcc_cell *c)
+ __attribute__((noinline));
+
+static void
+foo(int * interp, Pcc_cell *c)
+{
+ mark_cell(interp, c);
+}
+
+static struct Pcc_cell *
+__attribute__((noinline,noclone))
+getnull(void)
+{
+ return (struct Pcc_cell *) 0;
+}
+
+
+int main()
+{
+ int i;
+
+ for (i = 0; i < 100; i++)
+ foo (&gi, getnull ());
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of mark_cell" "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
new file mode 100644
index 0000000..462cade
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
@@ -0,0 +1,68 @@
+/* Test that IPA-CP is able to produce a pass-through jump function for the
+ call of g1 and g2 even though a is addressable. Also test that h is not
+ cloned. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+extern void use_stuff (int);
+extern void use_pointer (int *);
+
+static int
+h (int a, int b)
+{
+ int i;
+
+ for (i = 8; i <= b; i++)
+ use_stuff (a+8);
+}
+
+static int
+g1 (int a, int b)
+{
+ int i;
+
+ for (i = 0; i <= b; i++)
+ use_pointer (&a);
+ h (a, b);
+}
+
+static int
+g2 (int a, int b)
+{
+ int i;
+
+ for (i = 4; i <= b; i += 2)
+ use_stuff (a);
+}
+
+
+static void
+f (int a, int z)
+{
+ if (z > 1)
+ g1 (a, z);
+ else
+ g2 (a + 4, z);
+ use_pointer (&a);
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ for (i = 0; i < 100; i++)
+ f (7, argc);
+ return 0;
+}
+
+
+/* { 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 .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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c
new file mode 100644
index 0000000..b2e04f8
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c
new file mode 100644
index 0000000..7edfa40
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c
new file mode 100644
index 0000000..4c0a3e7
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c
new file mode 100644
index 0000000..1c1da4d
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c
new file mode 100644
index 0000000..9f6ee5b
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c
new file mode 100644
index 0000000..050e13b
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c
new file mode 100644
index 0000000..e85ca1a
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c
new file mode 100644
index 0000000..5014ffd
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c
new file mode 100644
index 0000000..e6b4b96
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-ii-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-ii-1.c
new file mode 100644
index 0000000..9caa54b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/ipcp-ii-1.c
@@ -0,0 +1,34 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -c -fdump-ipa-inline -fno-early-inlining" } */
+
+extern void non_existent(int);
+extern void non_existent(int);
+
+static void hooray ()
+{
+ non_existent (1);
+}
+
+static void __attribute__ ((noinline)) hiphip (void (*f)())
+{
+ f ();
+}
+
+int __attribute__ ((noinline,noclone)) get_input(void)
+{
+ return 1;
+}
+
+int main (int argc, int *argv[])
+{
+ int i;
+
+ for (i = 0; i < get_input (); i++)
+ hiphip (hooray);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "hooray\[^\\n\]*inline copy in hiphip.constprop" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/noclone-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/noclone-1.c
new file mode 100644
index 0000000..118df3a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/noclone-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
+
+int global_1, global_2;
+
+__attribute__((__noclone__)) int g (int b, int c)
+ {
+ global_1 = b;
+ global_2 = c;
+}
+
+__attribute__((__noclone__)) int f (int a)
+{
+ /* Second parameter of g gets different values. */
+ if (a > 0)
+ g (a, 3);
+ else
+ g (a, 5);
+}
+
+int main ()
+{
+ f (7);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump-times "versioned function" 0 "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr42706.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr42706.c
new file mode 100644
index 0000000..9c5f43a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr42706.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-early-inlining -fipa-sra" } */
+
+struct S
+{
+ float red;
+ int green;
+ void *blue;
+};
+
+extern int gi;
+static int foo ();
+
+int
+bar (void)
+{
+ foo ();
+ return 0;
+}
+
+static int
+foo (struct S s)
+{
+ gi = s.green;
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr45644.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr45644.c
new file mode 100644
index 0000000..3741020
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr45644.c
@@ -0,0 +1,36 @@
+/* Verify that we do not IPA-SRA bitfields. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target int32plus } */
+
+extern void abort (void);
+
+struct S
+{
+ int j : 8;
+ int i : 24;
+ int l;
+};
+
+static int __attribute__((noinline)) foo (struct S *s)
+{
+ int z = s->i;
+ if (z != 777)
+ abort ();
+ return 0;
+}
+
+int __attribute__((noinline)) bar (struct S *s)
+{
+ return foo (s);
+}
+
+int main (int argc, char *argv[])
+{
+ struct S s;
+ s.j = 5;
+ s.i = 777;
+ s.l = -1;
+
+ return bar (&s);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr48195.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr48195.c
new file mode 100644
index 0000000..2e38452
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr48195.c
@@ -0,0 +1,25 @@
+/* { dg-do link } */
+/* { dg-options "-O2 -flto --param partial-inlining-entry-probability=101" } */
+/* { dg-require-effective-target lto } */
+
+extern void abort(void);
+
+int i;
+
+void __attribute__ ((constructor))
+c2 ()
+{
+ if (i)
+ abort ();
+}
+
+void __attribute__ ((destructor))
+d1 ()
+{
+ if (i)
+ abort ();
+}
+
+void main ()
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr50744.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr50744.c
new file mode 100644
index 0000000..0535348
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr50744.c
@@ -0,0 +1,119 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-optimize-sibling-calls" } */
+
+extern int use_data (void *p_01, void *p_02, void *p_03, void *p_04, void *p_05,
+ void *p_06, void *p_07, void *p_08, void *p_09, void *p_10,
+ void *p_11, void *p_12, void *p_13, void *p_14, void *p_15,
+ void *p_16, void *p_17, void *p_18, void *p_19, void *p_20,
+ void *p_21, void *p_22, void *p_23, void *p_24, void *p_25,
+ void *p_26, void *p_27, void *p_28, void *p_29,
+ void *p_30);
+
+extern int idx (int i, int j, int n);
+
+struct stuff
+{
+ int decision;
+ int *a, *b, *c;
+ int res;
+};
+
+
+#define some_large_stuff(stuff, n) { \
+ int i, j, k; \
+ for (i = 0; i < n; i++) \
+ for (j = 0; j < n; j++) \
+ { \
+ int v = stuff->c[idx(i, j, n)]; \
+ for (k = 0; k < n; k++) \
+ v += stuff->a[idx(i, k, n)] * stuff->b[idx(k,j,n)]; \
+ stuff->c[idx(i, j, n)] = v; \
+ } \
+}
+
+#define recursion if (iter > 0) \
+ foo (stuff, iter - 1, (void *) -1, p_01, p_02, p_03, p_04, p_05, p_06, \
+ p_07, p_08, p_09, p_10, p_11, p_12, p_13, p_14, p_15, p_16, p_17, \
+ p_18, p_19, p_20, p_21, p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29); \
+ else \
+ foo (stuff, iter, p_01, p_02, p_03, p_04, p_05, p_06, p_07, p_08, p_09, \
+ p_10, p_11, p_12, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20, \
+ p_21,p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30)
+
+void
+foo (struct stuff *stuff,
+ int iter,
+ void *p_01, void *p_02, void *p_03, void *p_04, void *p_05,
+ void *p_06, void *p_07, void *p_08, void *p_09, void *p_10,
+ void *p_11, void *p_12, void *p_13, void *p_14, void *p_15,
+ void *p_16, void *p_17, void *p_18, void *p_19, void *p_20,
+ void *p_21, void *p_22, void *p_23, void *p_24, void *p_25,
+ void *p_26, void *p_27, void *p_28, void *p_29, void *p_30)
+{
+ switch (stuff->decision)
+ {
+ case 0:
+ some_large_stuff (stuff, 83);
+ stuff->res =
+ use_data (p_01, p_02, p_03, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
+ p_11, p_12, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
+ p_21, p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
+ recursion;
+ break;
+
+ case 1:
+ some_large_stuff (stuff, 25);
+ stuff->res =
+ use_data (p_11, p_02, p_03, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
+ p_21, p_12, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
+ p_01, p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
+ recursion;
+ break;
+
+ case 3:
+ some_large_stuff (stuff, 139);
+ stuff->res =
+ use_data (p_01, p_12, p_03, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
+ p_11, p_22, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
+ p_21, p_02, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
+ recursion;
+ break;
+
+ case 4:
+ some_large_stuff (stuff, 32);
+ stuff->res =
+ use_data (p_01, p_02, p_13, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
+ p_11, p_12, p_23, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
+ p_21, p_22, p_03, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
+ recursion;
+ break;
+
+ case 5:
+ some_large_stuff (stuff, 205);
+ stuff->res =
+ use_data (p_01, p_02, p_03, p_04, p_15, p_06, p_07, p_08, p_09, p_10,
+ p_11, p_12, p_13, p_14, p_25, p_16, p_17, p_18, p_19, p_20,
+ p_21, p_22, p_23, p_24, p_05, p_26, p_27, p_28, p_29, p_30);
+ recursion;
+ break;
+
+ case 6:
+ some_large_stuff (stuff, 64);
+ stuff->res =
+ use_data (p_01, p_02, p_03, p_04, p_05, p_16, p_07, p_08, p_09, p_10,
+ p_11, p_12, p_13, p_14, p_15, p_26, p_17, p_18, p_19, p_20,
+ p_21, p_22, p_23, p_24, p_25, p_06, p_27, p_28, p_29, p_30);
+ recursion;
+ break;
+ }
+}
+
+#define NULL (void *)0
+
+void
+bar (struct stuff *stuff, int iter)
+{
+ foo (stuff, iter, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr51362.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr51362.c
new file mode 100644
index 0000000..e57dd56
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr51362.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fipa-cp -fipa-cp-clone" } */
+
+int
+baz (void)
+{
+ return 0;
+}
+
+int make_mess;
+
+__attribute__ ((noinline))
+int bar (int x, int (*f) (void))
+{
+ return f ();
+}
+
+int
+foo (void)
+{
+ return bar (1, baz);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr55260.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr55260.c
new file mode 100644
index 0000000..ef151b0
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr56988.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr56988.c
new file mode 100644
index 0000000..ab20159
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr57294.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57294.c
new file mode 100644
index 0000000..0871f3f
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr57347.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57347.c
new file mode 100644
index 0000000..731b486
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr57358.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57358.c
new file mode 100644
index 0000000..c83396f
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr57539.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr57539.c
new file mode 100644
index 0000000..e02018e
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr58106.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr58106.c
new file mode 100644
index 0000000..b83353c
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr58492.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr58492.c
new file mode 100644
index 0000000..79958d5
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr59008.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr59008.c
new file mode 100644
index 0000000..b729672
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pr59610.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr59610.c
new file mode 100644
index 0000000..fc09334
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-1.c
new file mode 100644
index 0000000..f76dd87
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-1.c
@@ -0,0 +1,80 @@
+/* { 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;
+static int val;
+__attribute__ ((noinline, noclone))
+static int
+i_am_pure1 (int a)
+{
+ if (a > 50)
+ abort ();
+ return a;
+}
+
+__attribute__ ((noinline, noclone))
+static int
+i_am_const2 (int a)
+{
+ return a+val;
+}
+
+__attribute__ ((noinline, noclone))
+int
+call_me(int a)
+{
+ return a;
+}
+
+inline int
+call_callback(int (*fn)(int), int a)
+{
+ return fn(a);
+}
+
+__attribute__ ((noinline, noclone))
+i_am_const3(int a)
+{
+ return call_callback (call_me, a);
+}
+
+__attribute__ ((noinline))
+explode_badly()
+{
+ error_code = 0xbad;
+ abort ();
+}
+
+__attribute__ ((noinline, noclone))
+i_am_pure4(int a)
+{
+ if (a > 50)
+ explode_badly ();
+ return a;
+}
+
+test()
+{
+ int s;
+ s = i_am_pure1(5);
+ s += i_am_pure1(5);
+ s += i_am_const2(5);
+ s += i_am_const2(5);
+ s += i_am_const3(5);
+ s += i_am_const3(5);
+ s += i_am_pure4(5);
+ s += i_am_pure4(5);
+ return s;
+}
+/* { dg-final { scan-tree-dump-times "i_am_pure1 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "i_am_const2 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "i_am_const3 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "i_am_pure4 .5" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump "found to be looping pure: i_am_pure1" "local-pure-const1"} } */
+/* { dg-final { scan-tree-dump "found to be looping pure: i_am_pure4" "local-pure-const1"} } */
+/* { dg-final { scan-ipa-dump "found to be const: i_am_const2" "pure-const"} } */
+/* { dg-final { scan-ipa-dump "found to be const: i_am_const3" "pure-const"} } */
+/* { dg-final { cleanup-tree-dump "local-pure-const1" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+/* { dg-final { cleanup-ipa-dump "pure-const" } } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-2.c
new file mode 100644
index 0000000..2dcca18
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pure-const-2.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-local-pure-const1 -fdump-tree-optimized" } */
+static __attribute__ ((noinline, noclone))
+int i_am_pure(char *c, int n)
+{
+ char *d=__builtin_alloca (n);
+ int i;
+ int sum;
+ for (i=0;i<n;i++)
+ d[i] = c[i];
+ for (i=0;i<n;i++)
+ d[i] *= c[n-i];
+ for (i=0;i<n;i++)
+ sum+=d[i];
+ if (sum)
+ __builtin_unreachable ();
+ return sum;
+}
+char array[11];
+int
+main(void)
+{
+ i_am_pure (array,5);
+ i_am_pure (array,11);
+ return 0;
+}
+/* { dg-final { scan-tree-dump "found to be pure: i_am_pure" "local-pure-const1"} } */
+/* { dg-final { scan-tree-dump-not "i_am_pure" "optimized"} } */
+/* { dg-final { cleanup-tree-dump "local-pure-const1" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-0.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-0.c
new file mode 100644
index 0000000..a9e434a
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/remref-1a.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-1a.c
new file mode 100644
index 0000000..9db2bd6
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/remref-1b.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-1b.c
new file mode 100644
index 0000000..a17cf48
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/remref-2a.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-2a.c
new file mode 100644
index 0000000..1e0df2e
--- /dev/null
+++ b/gcc-4.9/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-4.9/gcc/testsuite/gcc.dg/ipa/remref-2b.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/remref-2b.c
new file mode 100644
index 0000000..554f306
--- /dev/null
+++ b/gcc-4.9/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" } } */