@@ -2,7 +2,7 @@
Previously we were failing by considering CLOBBER statement to be
a type change. */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-ipa-cp" } */
+/* { dg-options "-O2 -fdump-ipa-cp -fipa-cp-clone" } */
/* { dg-additional-options "-Wno-return-type" } */
struct A {
@@ -23,9 +23,12 @@ public:
C<int, int> b;
template <typename T, typename M> const M &C<T, M>::m_fn2(const T &) {
+
A a = _map.m_fn2();
a == _map.m_fn1();
m_fn1();
+ static M m;
+ return m;
}
void fn1() { b.m_fn2(0); }
new file mode 100644
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra" } */
+
+void fn1(int *, int *, double *, int *, double *);
+int a, c, d, e, f, g, k;
+double *b;
+double h, i;
+void fn2(int *p1, int *p2, double *p3) {
+ int l = 0, j, q, r;
+ double m, n, o, p, s, t, u;
+ --p3;
+ for (; a;) {
+ if (c) {
+ ++*p2;
+ goto L170;
+ }
+ m = n = b[c];
+ p = t = m;
+ for (; j; ++j) {
+ u = 1.;
+ if (k) {
+ s = o;
+ u = -1.;
+ }
+ }
+ i = u * p;
+ L60:
+ p3[1] = s;
+ for (; d;)
+ goto L60;
+ fn1(&f, &g, &h, &l, &p3[1]);
+ o = p3[1];
+ L100:
+ o *= i;
+ if (e)
+ goto L100;
+ L170:;
+ }
+ if (*p1)
+ for (;;) {
+ if (r)
+ q = *p2;
+ d = q - j;
+ r = j;
+ }
+}
new file mode 100644
@@ -0,0 +1,19 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-O2 -fipa-sra" } */
+
+class a {
+ void b();
+ char16_t c;
+ char16_t d;
+};
+void e(a);
+void g();
+void a::b() {
+ char16_t f = d;
+ e(*this);
+ for (;;) {
+ g();
+ if (f)
+ break;
+ }
+}
new file mode 100644
@@ -0,0 +1,9 @@
+/* { dg-options "-O2 -fipa-sra -fno-inline -fno-ipa-cp" } */
+
+
+char *a() __attribute__((__malloc__));
+static char *b() {
+ char *c = a();
+ return c;
+}
+int d() { b(); return 4; }
@@ -1,5 +1,5 @@
// { dg-do compile { target c++17 } }
-// { dg-options "-O2 -fdump-tree-eipa_sra" }
+// { dg-options "-O2 -fdump-ipa-sra" }
#include <type_traits>
@@ -37,4 +37,4 @@ int main() {
f(n2);
}
-// { dg-final { scan-tree-dump-times "Adjusting call" 2 "eipa_sra" } }
+// { dg-final { scan-ipa-dump "Will split parameter 0" "sra" } }
@@ -1,5 +1,5 @@
/* { dg-lto-do link } */
-/* { dg-lto-options { "-O2 -fdump-ipa-cp -Wno-return-type -flto -r -nostdlib" } } */
+/* { dg-lto-options { "-O2 -fdump-ipa-cp -fipa-cp-clone -Wno-return-type -flto -r -nostdlib" } } */
/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */
#include "../ipa/devirt-19.C"
/* { dg-final { scan-wpa-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */
new file mode 100644
@@ -0,0 +1,151 @@
+/* With -fwhole-program this is an excelent testcase for inlining IPA-SRAed
+ functions into each other. */
+/* { dg-do run } */
+/* { dg-options "-O2 -w -fno-ipa-cp -fwhole-program" } */
+/* { dg-require-effective-target int32plus } */
+
+#define PART_PRECISION (sizeof (cpp_num_part) * 8)
+
+typedef unsigned int cpp_num_part;
+typedef struct cpp_num cpp_num;
+struct cpp_num
+{
+ cpp_num_part high;
+ cpp_num_part low;
+ int unsignedp; /* True if value should be treated as unsigned. */
+ int overflow; /* True if the most recent calculation overflowed. */
+};
+
+static int
+num_positive (cpp_num num, unsigned int precision)
+{
+ if (precision > PART_PRECISION)
+ {
+ precision -= PART_PRECISION;
+ return (num.high & (cpp_num_part) 1 << (precision - 1)) == 0;
+ }
+
+ return (num.low & (cpp_num_part) 1 << (precision - 1)) == 0;
+}
+
+static cpp_num
+num_trim (cpp_num num, unsigned int precision)
+{
+ if (precision > PART_PRECISION)
+ {
+ precision -= PART_PRECISION;
+ if (precision < PART_PRECISION)
+ num.high &= ((cpp_num_part) 1 << precision) - 1;
+ }
+ else
+ {
+ if (precision < PART_PRECISION)
+ num.low &= ((cpp_num_part) 1 << precision) - 1;
+ num.high = 0;
+ }
+
+ return num;
+}
+
+/* Shift NUM, of width PRECISION, right by N bits. */
+static cpp_num
+num_rshift (cpp_num num, unsigned int precision, unsigned int n)
+{
+ cpp_num_part sign_mask;
+ int x = num_positive (num, precision);
+
+ if (num.unsignedp || x)
+ sign_mask = 0;
+ else
+ sign_mask = ~(cpp_num_part) 0;
+
+ if (n >= precision)
+ num.high = num.low = sign_mask;
+ else
+ {
+ /* Sign-extend. */
+ if (precision < PART_PRECISION)
+ num.high = sign_mask, num.low |= sign_mask << precision;
+ else if (precision < 2 * PART_PRECISION)
+ num.high |= sign_mask << (precision - PART_PRECISION);
+
+ if (n >= PART_PRECISION)
+ {
+ n -= PART_PRECISION;
+ num.low = num.high;
+ num.high = sign_mask;
+ }
+
+ if (n)
+ {
+ num.low = (num.low >> n) | (num.high << (PART_PRECISION - n));
+ num.high = (num.high >> n) | (sign_mask << (PART_PRECISION - n));
+ }
+ }
+
+ num = num_trim (num, precision);
+ num.overflow = 0;
+ return num;
+}
+ #define num_zerop(num) ((num.low | num.high) == 0)
+#define num_eq(num1, num2) (num1.low == num2.low && num1.high == num2.high)
+
+cpp_num
+num_lshift (cpp_num num, unsigned int precision, unsigned int n)
+{
+ if (n >= precision)
+ {
+ num.overflow = !num.unsignedp && !num_zerop (num);
+ num.high = num.low = 0;
+ }
+ else
+ {
+ cpp_num orig;
+ unsigned int m = n;
+
+ orig = num;
+ if (m >= PART_PRECISION)
+ {
+ m -= PART_PRECISION;
+ num.high = num.low;
+ num.low = 0;
+ }
+ if (m)
+ {
+ num.high = (num.high << m) | (num.low >> (PART_PRECISION - m));
+ num.low <<= m;
+ }
+ num = num_trim (num, precision);
+
+ if (num.unsignedp)
+ num.overflow = 0;
+ else
+ {
+ cpp_num maybe_orig = num_rshift (num, precision, n);
+ num.overflow = !num_eq (orig, maybe_orig);
+ }
+ }
+
+ return num;
+}
+
+unsigned int precision = 64;
+unsigned int n = 16;
+
+cpp_num num = { 0, 3, 0, 0 };
+
+int main()
+{
+ cpp_num res = num_lshift (num, 64, n);
+
+ if (res.low != 0x30000)
+ abort ();
+
+ if (res.high != 0)
+ abort ();
+
+ if (res.overflow != 0)
+ abort ();
+
+ exit (0);
+}
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra-details" } */
struct bovid
{
@@ -36,4 +36,4 @@ main (int argc, char *argv[])
return 0;
}
-/* { dg-final { scan-tree-dump-times "About to replace expr" 2 "eipa_sra" } } */
+/* { dg-final { scan-ipa-dump "Will split parameter" "sra" } } */
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+/* { dg-options "-O2 -fno-ipa-cp -fipa-sra -fdump-ipa-sra" } */
extern void consume (int);
extern int glob, glob1, glob2;
@@ -31,4 +31,4 @@ bar (int a)
return 0;
}
-/* { dg-final { scan-tree-dump-times "replacing an SSA name of a removed param" 4 "eipa_sra" } } */
+/* { dg-final { scan-ipa-dump "Will remove parameter 0" "sra" } } */
@@ -1,5 +1,5 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra-details" } */
struct bovid
{
@@ -36,4 +36,4 @@ main (int argc, char *argv[])
return 0;
}
-/* { dg-final { scan-tree-dump-not "About to replace expr" "eipa_sra" } } */
+/* { dg-final { scan-ipa-dump-not "Will split parameter" "sra" } } */
new file mode 100644
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */
+
+/* Check of a simple and transitive structure split. */
+
+struct S
+{
+ float red;
+ void *blue;
+ int green;
+};
+
+
+void __attribute__((noipa))
+check (float r, int g, int g2)
+{
+ if (r < 7.39 || r > 7.41
+ || g != 6 || g2 != 6)
+ __builtin_abort ();
+}
+
+static void
+__attribute__((noinline))
+foo (struct S s)
+{
+ check (s.red, s.green, s.green);
+}
+
+static void
+__attribute__((noinline))
+bar (struct S s)
+{
+ foo (s);
+}
+
+int
+main (int argc, char *argv[])
+{
+ struct S s;
+
+ s.red = 7.4;
+ s.green = 6;
+ s.blue = &s;
+
+ bar (s);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
+/* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" } } */
new file mode 100644
@@ -0,0 +1,49 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */
+
+/* Check of a by-reference structure split. */
+
+struct S
+{
+ float red;
+ void *blue;
+ int green;
+};
+
+void __attribute__((noipa))
+check (float r, int g, int g2)
+{
+ if (r < 7.39 || r > 7.41
+ || g != 6 || g2 != 6)
+ __builtin_abort ();
+}
+
+static void
+__attribute__((noinline))
+foo (struct S *s)
+{
+ check (s->red, s->green, s->green);
+}
+
+static void
+__attribute__((noinline))
+bar (struct S *s)
+{
+ foo (s);
+}
+
+int
+main (int argc, char *argv[])
+{
+ struct S s;
+
+ s.red = 7.4;
+ s.green = 6;
+ s.blue = &s;
+
+ bar (&s);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
+/* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" } } */
new file mode 100644
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */
+
+/* Check of a transitive recursive structure split. */
+
+struct S
+{
+ float red;
+ void *blue;
+ int green;
+};
+
+
+static int done = 0;
+
+void __attribute__((noipa))
+check (float r, int g, int g2)
+{
+ if (r < 7.39 || r > 7.41
+ || g != 6 || g2 != 6)
+ __builtin_abort ();
+}
+
+static void __attribute__((noinline)) bar (struct S s);
+
+static void
+__attribute__((noinline))
+foo (struct S s)
+{
+ if (!done)
+ {
+ done = 1;
+ bar (s);
+ }
+ check (s.red, s.green, s.green);
+}
+
+static void
+__attribute__((noinline))
+bar (struct S s)
+{
+ foo (s);
+}
+
+int
+main (int argc, char *argv[])
+{
+ struct S s;
+
+ s.red = 7.4;
+ s.green = 6;
+ s.blue = &s;
+
+ bar (s);
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
+/* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" } } */
new file mode 100644
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */
+
+/* Check of a recursive by-reference structure split. The recursive functions
+ have to be pure right from the start, otherwise the current AA would detect
+ possible modification of data. */
+
+struct S
+{
+ float red;
+ void *blue;
+ int green;
+};
+
+void __attribute__((noipa))
+check (float r, int g, int g2)
+{
+ if (r < 7.39 || r > 7.41
+ || g != 6 || g2 != 6)
+ __builtin_abort ();
+ return;
+}
+
+static int __attribute__((noinline, pure)) bar (struct S *s, int rec);
+
+static int
+__attribute__((noinline, pure))
+foo (struct S *s , int rec)
+{
+ int t = 0;
+ if (rec)
+ t = bar (s, 0);
+ check (s->red, s->green, s->green);
+ return t;
+}
+
+static int
+__attribute__((noinline, pure))
+bar (struct S *s, int rec)
+{
+ int t = foo (s, rec);
+ return t + t;
+}
+
+volatile int g;
+
+int
+main (int argc, char *argv[])
+{
+ struct S s;
+
+ s.red = 7.4;
+ s.green = 6;
+ s.blue = &s;
+
+ g = bar (&s, 1);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
+/* { dg-final { scan-ipa-dump-times "component at byte offset" 4 "sra" } } */
new file mode 100644
@@ -0,0 +1,74 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra -fdump-tree-optimized" } */
+
+/* Testing removal of unused parameters in recursive calls. */
+
+extern int work_1 (int);
+extern int work_2 (int);
+
+static int __attribute__((noinline))
+foo (int l, int w1, int w2, int useless, int useless2);
+
+
+static int __attribute__((noinline))
+bar_1 (int l, int w1, int w2, int useless, int useless2)
+{
+ return work_1 (w1) + foo (l, w1, w2, useless2, useless);
+}
+
+static int __attribute__((noinline))
+baz_1 (int useless, int useless2, int l, int w1, int w2)
+{
+ return bar_1 (l, w1, w2, useless, useless2);
+}
+
+static int __attribute__((noinline))
+bax_1 (int l, int w1, int w2, int useless, int useless2)
+{
+ return baz_1 (useless, useless2, l, w1, w2);
+}
+
+
+
+static int __attribute__((noinline))
+bar_2 (int l, int w1, int w2, int useless, int useless2)
+{
+ return foo (l, w1, w2, useless2 + 5, useless);
+}
+
+static int __attribute__((noinline))
+baz_2 (int useless, int useless2, int l, int w1, int w2)
+{
+ return bar_2 (l, w1, w2, useless, useless2);
+}
+
+
+static int __attribute__((noinline))
+bax_2 (int l, int w1, int w2, int useless, int useless2)
+{
+ return work_2 (w2) + baz_2 (useless, useless2, l, w1, w2);
+}
+
+
+static int __attribute__((noinline))
+ foo (int l, int w1, int w2, int useless, int useless2)
+{
+ int r = 0;
+ if (!l)
+ return r;
+ if (l % 2)
+ r = bax_1 (l - 1, w1, w2, useless, useless2);
+ else
+ r = bax_2 (l - 1, w1, w2, useless, useless2);
+
+ return r;
+}
+
+int
+entry (int l, int w1, int w2, int noneed, int noneed2)
+{
+ return foo (l, w2, w2, noneed2, noneed2 + 4);
+}
+
+/* { dg-final { scan-ipa-dump-times "Will remove parameter" 14 "sra" } } */
+/* { dg-final { scan-tree-dump-not "useless" "optimized"} } */
new file mode 100644
@@ -0,0 +1,102 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-sra -fdump-tree-optimized" } */
+
+#define DOIT
+#define DONT
+
+
+extern int extern_leaf (int);
+
+/* ----- 1 ----- */
+#ifdef DOIT
+static int __attribute__((noinline))
+whee_1 (int i, int j)
+{
+ return extern_leaf (i * j) + 1;
+}
+
+static int foo_1 (int i, int j);
+
+static int __attribute__((noinline))
+baz_1 (int i, int j)
+{
+ int a = 5;
+ if (j)
+ a = foo_1 (i, j - 1);
+ return whee_1 (i, j) + a + 1;
+}
+
+static int __attribute__((noinline))
+bar_1 (int i, int j)
+{
+ return baz_1 (i, j) + 1;
+}
+
+static int __attribute__((noinline))
+foo_1 (int i, int j)
+{
+ return bar_1 (i, j) + 1;
+}
+
+static int __attribute__((noinline))
+inter_1 (int i, int j)
+{
+ return foo_1 (i, j) + 1;
+}
+#endif
+
+/* ----- 2 ----- */
+#ifdef DONT
+static int __attribute__((noinline))
+whee_2 (int i, int j)
+{
+ return extern_leaf (i * j) + 2;
+}
+
+static int foo_2 (int i, int j);
+
+static int __attribute__((noinline))
+baz_2 (int i, int j)
+{
+ int a = 6;
+ if (j)
+ a = foo_2 (i, j - 1);
+ return whee_2 (i, j) + a + 2;
+}
+
+static int __attribute__((noinline))
+bar_2 (int i, int j)
+{
+ return baz_2 (i, j) + 2;
+}
+
+static int __attribute__((noinline))
+foo_2 (int i, int j)
+{
+ return bar_2 (i, j) + 2;
+}
+#endif
+
+/* ----- entries ----- */
+#ifdef DOIT
+int
+entry_1 (int i, int j)
+{
+ inter_1 (i, j);
+ return i + j + 1;
+}
+#endif
+
+#ifdef DONT
+int
+entry_2 (int i, int j)
+{
+#ifdef DOIT
+ inter_1 (i, j);
+#endif
+ return i + j + bar_2 (i, j);
+}
+#endif
+
+/* { dg-final { scan-ipa-dump-times "Will remove return value" 5 "sra" } } */
+/* { dg-final { scan-tree-dump-times "return;" 5 "optimized"} } */
new file mode 100644
@@ -0,0 +1,49 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-sra" } */
+
+struct S
+{
+ long a, b;
+};
+
+extern void leaf_a (int );
+extern void leaf_b (int, int);
+extern void leaf_c (int, int);
+
+extern void leaf_sa (struct S);
+
+static void baz (int i, int j, int k, int l, struct S a, struct S b);
+
+extern int gi;
+
+static void __attribute__((noinline))
+foo (int i, int j, int k, int l, struct S a, struct S b)
+{
+ gi += l;
+ baz (i, j, k, l, a, b);
+}
+
+static void __attribute__((noinline))
+bar (int i, int j, int k, int l, struct S a, struct S b)
+{
+ foo (i, j, k, l, a, b);
+ leaf_sa (b);
+}
+
+
+static void __attribute__((noinline))
+baz (int i, int j, int k, int l, struct S a, struct S b)
+{
+ if (--k)
+ bar (i, j, k, l, a, b);
+ leaf_b (i, k);
+}
+
+void
+entry (int i, int j, int k, int l, struct S a, struct S b)
+{
+ foo (i, j, k, l, a, b);
+}
+
+/* { dg-final { scan-ipa-dump-times "Will remove parameter 1" 3 "sra" } } */
+/* { dg-final { scan-ipa-dump-times "Will remove parameter 4" 3 "sra" } } */
new file mode 100644
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef int __attribute__((__vector_size__(16))) vectype;
+
+vectype dk();
+vectype k();
+
+int b;
+vectype *j;
+inline int c(vectype *d) {
+ vectype e;
+ vectype f;
+ vectype g = *d;
+ vectype h = g;
+ vectype i = h;
+ f = i == dk();
+ e = f == b;
+ k(e);
+}
+
+static void m(vectype *d) {
+ int l = c(d);
+ if (l)
+ c(j);
+}
+
+void o(void) {
+ vectype n;
+ m(&n);
+}
@@ -1,5 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+/* { dg-options "-O2 -fipa-sra" } */
+
+/* Functionality no longer available with IPA IPA-SRA. Test should be removed
+ altogether when committing the branch to trunk. */
struct bovid
{
@@ -45,7 +48,3 @@ int main (int argc, char *argv[])
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" } } */
new file mode 100644
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fipa-sra" } */
+
+typedef struct {
+ int a;
+} b;
+typedef struct {
+ double c;
+ double a;
+} d;
+typedef struct {
+ d e;
+ d f;
+} g;
+g h;
+b i, m;
+int j, k, l, n, o;
+static b q(d s) {
+ int r = s.c ?: 0;
+ if (r)
+ if (j)
+ l = j - 2;
+ o = k;
+ n = l;
+ i = m;
+ return m;
+}
+static void t(g s) {
+ {
+ d p = s.e;
+ int r = p.c ?: 0;
+ if (r) {
+ l = j - 2;
+ }
+ }
+ b f = q(s.f);
+}
+void main() { t(h); }
new file mode 100644
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef int a;
+typedef int b;
+int c, e;
+void i();
+void n(d, ab, f, ae, af, action, ag, ah, ai, g, h, aj, ak, al, j, k, am, an, ao,
+ l, m) int action,
+ ag;
+int f, ae, af;
+int ah, ai;
+int j, k;
+int l, m;
+a aj, am;
+int ak, al, an, ao, g, h;
+char d, ab;
+{
+ if (c)
+ i(e);
+}
+void o(d, ab, action, at, ag, g, h, aj, ak, al, au, av, am, an, ao, aw, ax, ay,
+ az, ba, bb, ai) int action,
+ ag;
+int at, ai;
+int au, av, aw, ax;
+b ay, ba;
+int az, bb;
+int g, h;
+int ak, al, an, ao;
+a aj, am;
+char d, ab;
+{ n(); }
new file mode 100644
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-sra" } */
+
+struct W
+{
+ int a, b;
+};
+
+union U
+{
+ struct W w;
+ long l;
+};
+
+struct Z
+{
+ int k;
+ union U u;
+};
+
+struct S
+{
+ int i, j;
+ struct Z z;
+ char buf[64];
+};
+
+struct W gw;
+
+
+static long
+__attribute__((noinline))
+foo (struct Z z)
+{
+ return z.u.l;
+}
+
+static long
+__attribute__((noinline))
+bar (struct S s)
+{
+ if (s.i > 100)
+ return s.z.u.w.a;
+ else
+ return foo (s.z);
+}
+
+volatile long g;
+
+long
+entry (struct S *p)
+{
+ struct S s = *p;
+
+ return bar (s) | 2;
+}
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+/* { dg-options "-O2 -fno-ipa-cp -fipa-sra -fdump-ipa-sra" } */
struct bovid
{
@@ -34,5 +34,6 @@ void caller (void)
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 { scan-ipa-dump "Will split parameter 0" "sra" } } */
+/* { dg-final { scan-ipa-dump "Will remove parameter 1" "sra" } } */
+/* { dg-final { scan-ipa-dump "Will remove parameter 2" "sra" } } */
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+/* { dg-options "-O2 -fipa-sra -fno-ipa-pure-const -fdump-ipa-sra" } */
static int
__attribute__((noinline))
@@ -61,7 +61,5 @@ void caller (void)
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 { scan-ipa-dump-times "Will split parameter" 2 "sra" } } */
+
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */
+/* { dg-options "-O2 -fipa-sra -fdump-ipa-sra" } */
static int *
__attribute__((noinline,used))
@@ -16,4 +16,4 @@ int *caller (void)
return ox (&a, &b);
}
-/* { dg-final { scan-tree-dump-times "base: j, remove_param" 0 "eipa_sra" } } */
+/* { dg-final { scan-ipa-dump-times "Will split parameter" 0 "sra" } } */
@@ -1,7 +1,10 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-slim" } */
+/* { dg-options "-O2 -fipa-sra" } */
/* { dg-require-effective-target non_strict_align } */
+/* Functionality no longer available with IPA IPA-SRA. Test should be removed
+ altogether when committing the branch to trunk. */
+
struct bovid
{
float a;
@@ -30,4 +33,3 @@ int main (int argc, char *argv[])
return foo (&cow, 0);
}
-/* { dg-final { scan-tree-dump-times "foo " 1 "eipa_sra" } } */
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining -fdump-tree-optimized -fno-ipa-icf" } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining -fno-ipa-sra -fdump-tree-optimized -fno-ipa-icf" } */
/* { dg-add-options bind_pic_locally } */
int array[100];
@@ -72,7 +72,7 @@ main()
}
/* { 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-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" } } */
@@ -1,6 +1,6 @@
/* 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" } */
+/* { dg-options "-O3 -fno-early-inlining -fno-ipa-sra -fdump-ipa-cp -fdump-ipa-inline" } */
struct S
{
@@ -13,4 +13,4 @@ static void fn1(c) unsigned char c;
void fn3() { fn1 (267); }
-/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\\[11, 35\\\]" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\(now 0\\) \\\[11, 35\\\]" "cp" } } */
@@ -28,5 +28,5 @@ int main ()
return 0;
}
-/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\\[6," "cp" } } */
-/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\\[0, 999\\\]" "cp" } } */
+/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\(now 0\\) \\\[6," "cp" } } */
+/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\(now 0\\) \\\[0, 999\\\]" "cp" } } */
@@ -31,5 +31,5 @@ int main ()
return 0;
}
-/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\\[4," "cp" } } */
-/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\\[0, 11\\\]" "cp" } } */
+/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\(now 0\\) \\\[4," "cp" } } */
+/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\(now 0\\) \\\[0, 11\\\]" "cp" } } */
@@ -27,4 +27,4 @@ int main ()
return 0;
}
-/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\\[0, 9\\\]" 2 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\(now 0\\) \\\[0, 9\\\]" 2 "cp" } } */
@@ -29,4 +29,4 @@ int main ()
return 0;
}
-/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\\[-10, 9\\\]" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\(now 0\\) \\\[-10, 9\\\]" 1 "cp" } } */
@@ -39,4 +39,4 @@ main ()
return 0;
}
-/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\\[-10, 9\\\]" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\(now 0\\) \\\[-10, 9\\\]" 1 "cp" } } */
@@ -13,7 +13,7 @@ static int func2(void);
asm("firstasm");
-NOREORDER __attribute__((noinline)) int bozo(void)
+NOREORDER __attribute__((noipa)) int bozo(void)
{
f2(3);
func2();
@@ -21,14 +21,14 @@ NOREORDER __attribute__((noinline)) int bozo(void)
asm("jukjuk");
-NOREORDER __attribute__((noinline)) static int func1(void)
+NOREORDER __attribute__((noipa)) static int func1(void)
{
f2(1);
}
asm("barbar");
-NOREORDER __attribute__((noinline)) static int func2(void)
+NOREORDER __attribute__((noipa)) static int func2(void)
{
func1();
}
new file mode 100644
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fipa-sra" } */
+
+
+struct __attribute__((scalar_storage_order("little-endian"))) LE
+{
+ int i;
+ int j;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) BE
+{
+ int i;
+ int j;
+};
+
+struct LE gle;
+struct BE gbe;
+
+#define VAL 0x12345678
+
+void __attribute__((noipa))
+fill (void)
+{
+ gle.i = VAL;
+ gle.j = 0xdeadbeef;
+ gbe.i = VAL;
+ gbe.j = 0x11223344;
+}
+
+static int __attribute__((noinline))
+readLE (struct LE p)
+{
+ return p.i;
+}
+
+static int __attribute__((noinline))
+readBE (struct BE p)
+{
+ return p.i;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int r;
+ fill ();
+
+ r = readLE (gle);
+ if (r != VAL)
+ __builtin_abort ();
+ r = readBE (gbe);
+ if (r != VAL)
+ __builtin_abort ();
+
+ return 0;
+}
@@ -14,7 +14,7 @@ very_long_function(int a)
int
blah ()
{
- very_long_function (1);
+ return very_long_function (1);
}
/* One appearance for dump, one self recursive call and one call from main. */
/* { dg-final { scan-tree-dump-times "very_long_function.constprop \\(\\)" 3 "optimized"} } */