aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-value-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr95801.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-35.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-14.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/tailcall-15.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp122.c4
10 files changed, 97 insertions, 14 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-value-5.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-value-5.c
index 12ba475..ed8ee3a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-value-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-value-5.c
@@ -31,9 +31,7 @@ int fdiv1(int a, int b)
return a != 0 ? c : 0;
}
-/* fdiv1 requires until later than phiopt2 to be able to detect that
- d is non-zero. to be able to remove the conditional. */
-/* { dg-final { scan-tree-dump-times "goto" 2 "phiopt2" } } */
+/* { dg-final { scan-tree-dump-not "goto" "phiopt2" } } */
/* { dg-final { scan-tree-dump-not "goto" "phiopt3" } } */
/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr95801.c b/gcc/testsuite/gcc.dg/tree-ssa/pr95801.c
new file mode 100644
index 0000000..c3c80a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr95801.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+int always1(int a, int b) {
+ if (a / b)
+ return b != 0;
+ return 1;
+}
+
+// If b != 0 is optimized by recognizing divide by 0 cannot happen,
+// there should be no PHI node.
+
+// { dg-final { scan-tree-dump-not "PHI" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c
index c569523..469e493 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c
@@ -1,6 +1,5 @@
/* A test for various conversions of chrecs. */
-/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
void blas (signed char xxx);
@@ -22,6 +21,6 @@ void tst(void)
blau ((unsigned char) i);
}
-/* { dg-final { scan-tree-dump-times "& 255" 1 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "= \\(signed char\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= \\(unsigned char\\)" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= \\(signed char\\)" 3 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index d84acee..8be9878 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -11,8 +11,8 @@
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 17" "thread2" { target { aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 10" "thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 14" "thread2" { target { aarch64*-*-* } } } } */
enum STATE {
S0=0,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c
index 5a7588f..246fea3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c
@@ -1,6 +1,4 @@
-/* If the target returns false for TARGET_PROMOTE_PROTOTYPES, then there
- will be no casts for FRE to eliminate and the test will fail. */
-/* { dg-do compile { target i?86-*-* x86_64-*-* hppa*-*-* m68k*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O -fno-tree-ccp -fno-tree-forwprop -fdump-tree-fre1-details" } */
/* From PR21608. */
@@ -11,4 +9,4 @@ char bar(char f)
return wrap(f);
}
-/* { dg-final { scan-tree-dump "Replaced \\\(char\\\) .*with " "fre1" } } */
+/* { dg-final { scan-tree-dump-not " = \\\(\[^)\]*\\\)" "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-35.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-35.c
new file mode 100644
index 0000000..1b49445
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-35.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+
+void bar (int *);
+
+struct X { int a[2]; };
+void foo (struct X *p, int b)
+{
+ if (b)
+ bar ((int *)p + 1);
+ bar (&p->a[1]);
+}
+
+/* We should PRE and hoist &p->a[1] as (int *)p + 1. */
+/* { dg-final { scan-tree-dump "HOIST inserted: 1" "pre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c
new file mode 100644
index 0000000..930360a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c
@@ -0,0 +1,19 @@
+/* PR120003 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-cddce3-details" } */
+
+extern _Bool g(int);
+
+_Bool f()
+{
+ _Bool retval = 0;
+ for(int i=0; i<1000000; ++i)
+ retval = retval || g(i);
+ return retval;
+}
+
+/* Jump threading after loop optimization should get the counting loop
+ separated from the loop until retval is true and CD-DCE elide it.
+ It's difficult to check for the fact that a true retval terminates
+ the loop so check CD-DCE eliminates one loop instead. */
+/* { dg-final { scan-tree-dump "fix_loop_structure: removing loop" "cddce3" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-14.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-14.c
new file mode 100644
index 0000000..6fadff8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-14.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-tailc-details" } */
+
+/* PR tree-optimization/67797 */
+
+void *my_func(void *s, int n)
+{
+ __builtin_memset(s, 0, n);
+ return s;
+}
+void *my_func1(void *d, void *s, int n)
+{
+ __builtin_memcpy(d, s, n);
+ return d;
+}
+void *my_func2(void *s, void *p1, int n)
+{
+ if (p1)
+ __builtin_memcpy(s, p1, n);
+ else
+ __builtin_memset(s, 0, n);
+ return s;
+}
+
+/* { dg-final { scan-tree-dump-times "Found tail call" 4 "tailc"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/tailcall-15.c b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-15.c
new file mode 100644
index 0000000..bf24fd8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/tailcall-15.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-tailc-details" } */
+
+/* PR tree-optimization/67797 */
+
+/* We should not get a tail call here since the
+ types don't match and we don't know how the argument
+ truncation will work. */
+
+unsigned char my_func(int n)
+{
+ __builtin_memset((void*)0, 0, n);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "Found tail call" "tailc"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp122.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp122.c
index 5a4ca85..def2b89 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp122.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp122.c
@@ -1,5 +1,5 @@
// { dg-do compile }
-// { dg-options "-O2 -fdump-tree-evrp-details" }
+// { dg-options "-O2 -fdump-tree-ccp1-details" }
void gg(void);
int f(unsigned t)
@@ -16,4 +16,4 @@ int f(unsigned t)
return 0;
}
-// { dg-final { scan-tree-dump "Global Exported: g_.* MASK 0x1 VALUE 0x0" "evrp" } }
+// { dg-final { scan-tree-dump "Global Exported: g_.*MASK.*0 VALUE 0x0" "ccp1" } }