diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa')
30 files changed, 308 insertions, 28 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c index 3b1ace80f39..1ad2c63653c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20030728-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-final_cleanup" } */ union tree_node; @@ -42,6 +42,6 @@ objects_must_conflict_p (t1, t2) } /* There should be two assignments of variables to the value zero. */ -/* { dg-final { scan-tree-dump-times " = 0" 2 "optimized"} } */ +/* { dg-final { scan-tree-dump-times " = 0" 2 "final_cleanup"} } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20080530.c b/gcc/testsuite/gcc.dg/tree-ssa/20080530.c new file mode 100644 index 00000000000..6da7cb8a03a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/20080530.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-einline" } */ + +void bar (char *); +int i; + +static void +foo (void) +{ + char *p = __builtin_alloca (i); + bar (p); +} + +int +baz (void) +{ + foo (); /* foo() should not be inlined here because it calls alloca */ + return 6; +} + +/* { dg-final { scan-tree-dump-times "Inlining foo into baz" 0 "einline2"} } */ +/* { dg-final { cleanup-tree-dump "einline2" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c b/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c index 5eb71d9be9e..92b60999495 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/data-dep-1.c @@ -25,5 +25,5 @@ int foo (int n, int m) outermost "k" loop: the 4 comes from the instantiation of the number of iterations of loop "j". */ -/* { dg-final { scan-tree-dump-times "4, \\+, 1" 0 "ltrans" } } */ +/* { dg-final { scan-tree-dump-times "4, \\+, 1" 0 "ltrans" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "ltrans" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-2.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-2.c new file mode 100644 index 00000000000..8a7b9070de5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-2.c @@ -0,0 +1,17 @@ +/* { dg-do link } */ +/* { dg-options "-O" } */ + +/* When optimized we expect the call to foo () in bar to be inlined + and the call to link_error optimized away. */ + +extern void link_error (void); +int __attribute__((always_inline)) foo(void) { return 0; } + +int main() +{ + int (*fn)(void) = foo; + if (fn()) + link_error (); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c b/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c index d3264367db8..e26fa9302b4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loadpre1.c @@ -14,5 +14,5 @@ int main(int *a, int argc) e = *a; return d + e; } -/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c index 577e1795e74..d7b72f9f754 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c @@ -17,5 +17,5 @@ f (void) link_error (); } -/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "ccp1"} } */ +/* { dg-final { scan-tree-dump-times "Folded into: if " 1 "ccp1"} } */ /* { dg-final { cleanup-tree-dump "ccp\[1-2\]" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c b/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c index 33c3f5c530c..50b3bfd565a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr30375.c @@ -22,5 +22,5 @@ void test_signed_msg_encoding(void) f(); } -/* { dg-final { scan-tree-dump-times "signInfo = {};" 1 "dse1" } } */ +/* { dg-final { scan-tree-dump-times "signInfo = {}" 1 "dse1" } } */ /* { dg-final { cleanup-tree-dump "dse*" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c new file mode 100644 index 00000000000..24141ef34e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ + +int test1 (int x, int y, int z, int weight) +{ + int tmp1 = x * weight; + int tmp2 = y * weight; + int tmp3 = (x - y) * weight; + return tmp1 + (tmp2 + tmp3); +} + +int test2 (int x, int y, int z, int weight) +{ + int tmp1 = x * weight; + int tmp2 = y * weight * weight; + int tmp3 = z * weight * weight * weight; + return tmp1 + tmp2 + tmp3; +} + +/* There should be one multiplication left in test1 and three in test2. */ + +/* { dg-final { scan-tree-dump-times "\\\*" 4 "reassoc1" } } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-15.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-15.c new file mode 100644 index 00000000000..d9b74d27785 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-15.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ + +int test3 (int x, int y, int z, int weight, int w1, int w2, int w3) +{ + int wtmp1 = w1 * weight; + int wtmp2 = w2 * weight; + int wtmp3 = w3 * weight; + int tmp1 = x * wtmp1; + int tmp2 = y * wtmp2; + int tmp3 = z * wtmp3; + return tmp1 + tmp2 + tmp3; +} + +/* The multiplication with weight should be un-distributed. + ??? This pattern is not recognized currently. */ + +/* { dg-final { scan-tree-dump-times "\\\*" 4 "reassoc1" } } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-16.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-16.c new file mode 100644 index 00000000000..4dd54a8cba9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-16.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ffast-math -fdump-tree-reassoc1" } */ + +double test1 (double x, double y, double z, double weight) +{ + double tmp1 = x / weight; + double tmp2 = y / weight; + double tmp3 = -x / weight; + return tmp1 + tmp2 + tmp3; +} + +/* The division should be un-distributed and all references to x should + be gone. */ + +/* { dg-final { scan-tree-dump-times "/" 1 "reassoc1" } } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-17.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-17.c new file mode 100644 index 00000000000..255c786d737 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-17.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ffast-math -fdump-tree-reassoc1" } */ + +double test2 (double x, double y, double ddj, int b) +{ + double tmp1, tmp2, sum; + sum = 0.0; + if (b) + sum = 1.0; + tmp1 = sum/ddj; + tmp2 = x/ddj; + return tmp1 + y + tmp2; +} + +/* { dg-final { scan-tree-dump-times "/" 1 "reassoc1" } } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-18.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-18.c new file mode 100644 index 00000000000..ce52cd0d04e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-18.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-reassoc1" } */ + +int +ETree_nFactorEntriesInFront (int b, int m) +{ + int nent = b*b + 2*b*m; + return nent; +} + +/* { dg-final { scan-tree-dump-times "\\\*" 2 "reassoc1" } } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c index 6103c400ecb..178e6a44822 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c @@ -1,3 +1,4 @@ +/* { dg-options "" } */ int main(int a, int b, int c, int d) { int e = (a & ~b) & (~c & d); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c index af628053ad5..be754145e7d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-2.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ /* { dg-options "-O1 -funsafe-math-optimizations -fdump-tree-recip" } */ -float e(float a, float b, float c, float d, float e, float f) +float u, v, w, x, y, z; + +void e(float a, float b, float c, float d, float e, float f) { if (a < b) { @@ -20,7 +22,12 @@ float e(float a, float b, float c, float d, float e, float f) /* This should not be left as a multiplication. */ c = 1 / c; - return a + b + c + d + e + f; + u = a; + v = b; + w = c; + x = d; + y = e; + z = f; } /* { dg-final { scan-tree-dump-times " / " 2 "recip" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c index 60fefd01da5..b3334fb862a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-6.c @@ -5,7 +5,9 @@ extern int f2(); -double f1(double y, double z, double w) +double m, n, o; + +void f1(double y, double z, double w) { double b, c, d, e, f; @@ -18,7 +20,9 @@ double f1(double y, double z, double w) e = c / y; f = 1 / y; - return d + e + f; + m = d; + n = e; + o = f; } /* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c index af1bf3c008b..98bbdca6e2c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-7.c @@ -5,7 +5,9 @@ extern double h(); -double f(int x, double z, double w) +double m, n, o; + +void f(int x, double z, double w) { double b, c, d, e, f; double y = h (); @@ -19,7 +21,9 @@ double f(int x, double z, double w) e = c / y; f = 1 / y; - return d + e + f; + m = d; + n = e; + o = f; } /* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-20.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-20.c new file mode 100644 index 00000000000..63febd0e04f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-20.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-ccp1" } */ + +/* Make sure CCP propagates through indirect calls. */ + +int foo (void) +{ + int i = -5; + int (*fn)(int) = __builtin_abs; + int j = fn(i); + return j + 5; +} + +/* { dg-final { scan-tree-dump "return 10;" "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c new file mode 100644 index 00000000000..3b23c36238e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-ccp1" } */ + +struct A { + struct B { + int i; + } b; +} a; + +int foo (void) +{ + struct B *p = &a.b; + struct A *q = (struct A *) p; + return q->b.i; +} + +int bar (void) +{ + struct A *p = &a; + struct B *q = (struct B *) p; + return q->i; +} + +/* { dg-final { scan-tree-dump-times "a.b.i" 2 "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-22.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-22.c new file mode 100644 index 00000000000..01d11ecac87 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-22.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-ccp1" } */ + +/* Make sure we propagate through builtins. */ + +int foo (unsigned b) +{ + unsigned t = -1; + int x = b <= t; + long l = __builtin_expect (x, 0); + return l; +} + +/* { dg-final { scan-tree-dump "return 1;" "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c new file mode 100644 index 00000000000..ac7f068cfd1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-ccp1" } */ + +/* Make sure we propagate through POINTER_PLUS_EXPRs. */ + +struct A { + int i[2]; +} a; + +int foo (void) +{ + struct A *p = &a; + int *q = (int *)p; + int *x = q + 1; + return *x; +} + +/* { dg-final { scan-tree-dump "a.i\\\[1\\\]" "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c index 3253afe2927..bb48c0a391b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c @@ -25,6 +25,6 @@ void foo(double (*q)[4], struct Foo *tmp1) } } -/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */ -/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data" "fre" } } */ +/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data" "fre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c index d2d5e01bcc4..61c5e00b554 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c @@ -27,6 +27,6 @@ void foo(double (*q)[4]) } } -/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */ -/* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" } } */ +/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c index aced64977ea..68fbb454c76 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-17.c @@ -18,6 +18,6 @@ int foo(int i, int j, int k) return f.doms[0LL].dom; } -/* { dg-final { scan-tree-dump "Replaced f.doms\\\[0\\\].dom with i_" "fre" } } */ +/* { dg-final { scan-tree-dump "Replaced f.doms\\\[0\\\].dom with i_" "fre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c index bd81831eba8..d93a1a21456 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-7.c @@ -29,10 +29,10 @@ intflt foo(intflt j) return a.u.k; } -/* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre" } } */ -/* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre" } } */ -/* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre" } } */ -/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre" } } */ -/* { dg-final { scan-tree-dump "return j" "optimized" } } */ +/* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "return j" "optimized" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "fre" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c index 6e17bd531b3..1494dbbbd94 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c @@ -28,6 +28,6 @@ intflt foo(int i, int b) } } -/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" } } */ -/* { dg-final { scan-tree-dump-times "Inserted pretmp" 2 "fre" } } */ +/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Inserted pretmp" 2 "fre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c index 18595ed6fe5..24c4ae37167 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-9.c @@ -23,6 +23,6 @@ void __frame_state_for1 (volatile char *state_in) } } -/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" } } */ -/* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" } } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c index 518fda854e6..f080989d1de 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c @@ -12,5 +12,5 @@ __SIZE_TYPE__ mystrlen (const char *s) return strlen(s); } -/* { dg-final { scan-tree-dump "= 0;" "optimized" } } */ +/* { dg-final { scan-tree-dump "= 0;" "optimized" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-18.c new file mode 100644 index 00000000000..5e92934f052 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-18.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-details" } */ + +struct Bar { int a; int b; }; +struct Foo { int x; struct Bar y; }; + +int __attribute__((const)) foo (struct Bar); + +int bar (int b) +{ + struct Foo f; + int c; + while (b--) + { + c = foo(f.y); + } + return c; +} + +/* { dg-final { scan-tree-dump "Replaced foo \\(f.y\\)" "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-3.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-3.c new file mode 100644 index 00000000000..4055bc3f52d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-3.c @@ -0,0 +1,28 @@ +/* The return argument needs a type conversion which on some targets + (e.g. s390) needs additional code. So it is invalid to do tail + call optimization here. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +long long __attribute__((noinline)) +foo () +{ + return 3; +} + +int __attribute__((noinline)) +boo () +{ + return foo (); +} + +int +main () +{ + if (boo () != 3) + abort (); +} + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c new file mode 100644 index 00000000000..e7983da31da --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-tailc-details" } */ +/* PR tree-opt/37024 */ + +double doubleValue(); + +long +longValue () +{ + return (long) doubleValue (); +} + +/* We should not tail call doubleValue in longValue as the mode changes. */ +/* { dg-final { scan-tree-dump-times "Found tail call" 0 "tailc"} } */ +/* { dg-final { cleanup-tree-dump "tailc" } } */ + |