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/20031106-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/abs-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c43
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-value-5.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c39
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr114864.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120080.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c67
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c107
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr31261.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr35286.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr57361.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr78154-2.c38
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr95801.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr98265.C348
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-41.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c25
-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/switch-5.c60
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/switch-6.c51
-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
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp124.c31
57 files changed, 854 insertions, 398 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
index 56d1887b..c7e0088 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
@@ -1,5 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized" } */
+/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized -fdump-tree-forwprop1-details" } */
+
+/* PR tree-optimization/14295 */
extern void link_error (void);
@@ -25,4 +27,6 @@ struct s foo (struct s r)
/* There should be no references to any of "temp_struct*"
temporaries. */
-/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */
+/* Also check that forwprop pass did the copy prop. */
+/* { dg-final { scan-tree-dump-times "after previous" 3 "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c b/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
index 4144d1c..f43018d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
-/* { dg-additional-options "-msse -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* PR tree-optimization/109829 */
float abs_f(float x) { return __builtin_signbit(x) ? x : -x; }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c b/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
index dbde681..efb53f1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-backprop-details" } */
-/* { dg-additional-options "-msse -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
void start (void *);
void end (void *);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-4.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-4.c
index 97a385e..d25a960 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-4.c
@@ -26,7 +26,7 @@ extern int vsnprintf (char*, size_t, const char*, va_list);
/* Macro to emit a call to function named
call_in_true_branch_not_eliminated_on_line_NNN()
for each expression that's expected to fold to false but that
- GCC does not fold. The dg-final scan-tree-dump-time directive
+ GCC does not fold. The dg-final scan-tree-dump-times directive
at the bottom of the test verifies that no such call appears
in output. */
#define ELIM(expr) \
@@ -35,7 +35,7 @@ extern int vsnprintf (char*, size_t, const char*, va_list);
/* Macro to emit a call to a function named
call_made_in_{true,false}_branch_on_line_NNN()
for each call that's expected to be retained. The dg-final
- scan-tree-dump-time directive at the bottom of the test verifies
+ scan-tree-dump-times directive at the bottom of the test verifies
that the expected number of both kinds of calls appears in output
(a pair for each line with the invocation of the KEEP() macro. */
#define KEEP(expr) \
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c
index df09c81..806a1f4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-6.c
@@ -23,7 +23,7 @@ int snprintf (char * restrict, size_t, const char *restrict, ...);
/* Macro to emit a call to funcation named
call_in_true_branch_not_eliminated_on_line_NNN()
for each call that's expected to be eliminated. The dg-final
- scan-tree-dump-time directive at the bottom of the test verifies
+ scan-tree-dump-times directive at the bottom of the test verifies
that no such call appears in output. */
#define ELIM(expr) \
if (!(expr)) FAIL (in_true_branch_not_eliminated, __COUNTER__); else (void)0
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-7.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-7.c
index bf5072e..f7cb280 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-7.c
@@ -25,7 +25,7 @@ void sink (void*, ...);
/* Macro to emit a call to funcation named
call_in_true_branch_not_eliminated_on_line_NNN()
for each call that's expected to be eliminated. The dg-final
- scan-tree-dump-time directive at the bottom of the test verifies
+ scan-tree-dump-times directive at the bottom of the test verifies
that no such call appears in output. */
#define VERIFY_ELIM(expr) \
if (!(expr)) FAIL (in_true_branch_not_eliminated, __COUNTER__); else (void)0
@@ -33,7 +33,7 @@ void sink (void*, ...);
/* Macro to emit a call to a function named
call_made_in_{true,false}_branch_on_line_NNN()
for each call that's expected to be retained. The dg-final
- scan-tree-dump-time directive at the bottom of the test verifies
+ scan-tree-dump-times directive at the bottom of the test verifies
that the expected number of both kinds of calls appears in output
(a pair for each line with the invocation of the KEEP() macro. */
#define VERIFY_KEEP(expr) \
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c
index 489af62..73e807f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c
@@ -21,7 +21,7 @@ extern int snprintf (char*, size_t, const char*, ...);
/* Macro to emit a call to funcation named
call_in_true_branch_not_eliminated_on_line_NNN()
for each call that's expected to be eliminated. The dg-final
- scan-tree-dump-time directive at the bottom of the test verifies
+ scan-tree-dump-times directive at the bottom of the test verifies
that no such call appears in output. */
#define ELIM(expr) \
if (!(expr)) FAIL (in_true_branch_not_eliminated); else (void)0
@@ -29,7 +29,7 @@ extern int snprintf (char*, size_t, const char*, ...);
/* Macro to emit a call to a function named
call_made_in_{true,false}_branch_on_line_NNN()
for each call that's expected to be retained. The dg-final
- scan-tree-dump-time directive at the bottom of the test verifies
+ scan-tree-dump-times directive at the bottom of the test verifies
that the expected number of both kinds of calls appears in output
(a pair for each line with the invocation of the KEEP() macro. */
#define KEEP(expr) \
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c
index 3be18c7..fca7800 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c
@@ -20,7 +20,7 @@ extern int snprintf (char*, size_t, const char*, ...);
/* Macro to emit a call to funcation named
call_in_true_branch_not_eliminated_on_line_NNN()
for each expression that's expected to fold to false but that
- GCC does not fold. The dg-final scan-tree-dump-time directive
+ GCC does not fold. The dg-final scan-tree-dump-times directive
at the bottom of the test verifies that no such call appears
in output. */
#define ELIM(expr) \
@@ -29,7 +29,7 @@ extern int snprintf (char*, size_t, const char*, ...);
/* Macro to emit a call to a function named
call_made_in_{true,false}_branch_on_line_NNN()
for each call that's expected to be retained. The dg-final
- scan-tree-dump-time directive at the bottom of the test verifies
+ scan-tree-dump-times directive at the bottom of the test verifies
that the expected number of both kinds of calls appears in output
(a pair for each line with the invocation of the KEEP() macro. */
#define KEEP(expr) \
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c b/gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c
new file mode 100644
index 0000000..d765a03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c
@@ -0,0 +1,43 @@
+/* PR tree-optimization/120451 */
+/* { dg-do compile { target elf } } */
+/* { dg-options "-O2" } */
+
+void foo (int, int);
+
+__attribute__((noinline, noclone)) void
+f1 (int v, int w)
+{
+ int i, j;
+ if (w)
+ {
+ i = 129;
+ j = i - 1;
+ goto lab;
+ }
+ switch (v)
+ {
+ case 170:
+ j = 7;
+ i = 27;
+ break;
+ case 171:
+ i = 8;
+ j = 122;
+ break;
+ case 172:
+ i = 21;
+ j = -19;
+ break;
+ case 173:
+ i = 18;
+ j = 17;
+ break;
+ default:
+ __builtin_abort ();
+ }
+
+ lab:
+ foo (i, j);
+}
+
+/* { dg-final { scan-assembler ".rodata.cst16" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c
index a1f0828..1c5b500 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-41.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized -Wno-psabi -w" } */
+/* { dg-additional-options "-msse" { target i?86-*-* x86_64-*-* } } */
#define vector __attribute__((__vector_size__(16) ))
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c
index 5c0ea58..4b3ce4e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c
@@ -9,7 +9,8 @@
/* unaligned store. */
-int main_1 (int off)
+int __attribute__((noipa))
+main_1 (int off)
{
int i;
char ia[N+OFF];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c
new file mode 100644
index 0000000..801a53f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-1.c
@@ -0,0 +1,19 @@
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -ftree-vectorize -fdump-tree-ifcvt-stats" } */
+
+void
+test (int *dst, float *arr, int *pred, int n)
+{
+ for (int i = 0; i < n; i++)
+ {
+ int pred_i = pred[i];
+ float arr_i = arr[i];
+
+ dst[i] = pred_i ? (int)arr_i : 5;
+ }
+}
+
+/* We expect this to fail if_convertible_loop_p so long as we have no
+ conditional IFN for FIX_TRUNC_EXPR. */
+
+/* { dg-final { scan-tree-dump-times "Applying if-conversion" 0 "ifcvt" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c
new file mode 100644
index 0000000..628b754
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifcvt-fix-trunc-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -fno-trapping-math -fdump-tree-ifcvt-stats" } */
+
+#include "ifcvt-fix-trunc-1.c"
+
+/* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "ifcvt" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c
index a9011ce..7062916 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c
@@ -20,6 +20,7 @@ int f1(int x)
/* { dg-final { scan-tree-dump-times "if " 1 "phiopt1" } } */
/* { dg-final { scan-tree-dump-not "if " "phiopt2" } } */
-/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 2 "phiopt1" } } */
-/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 1 "phiopt2" } } */
-/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 1 "phiopt2" } } */
+/* The ABS_EXPR in f gets rewritten to ABSU_EXPR as phiopt can't prove it was not undefined when moving it. */
+/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 2 "phiopt2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c
index 9774e28..817d4fe 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c
@@ -29,6 +29,6 @@ int fge(int a, unsigned char b)
return a > 0 ? a : -a;
}
-
+/* The ABS_EXPR gets rewritten to ABSU_EXPR as phiopt can't prove it was not undefined when moving it. */
/* { dg-final { scan-tree-dump-not "if " "phiopt1" } } */
-/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 4 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 4 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
index 3ee43e5..9b180d5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
@@ -16,7 +16,7 @@ int f(int t, int c)
}
/* There should be no ifs as this is converted into `(t != 0) & (c != 0)`.
-/* { dg-final { scan-tree-dump-not "if" "optimized" } }*/
+/* { dg-final { scan-tree-dump-not "if" "optimized" } } */
/* { dg-final { scan-tree-dump-times "\[^\r\n\]*_\[0-9\]* = c_\[0-9\]*.D. != 0" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\[^\r\n\]*_\[0-9\]* = t_\[0-9\]*.D. != 0" 1 "optimized" } } */
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 8062eb1..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
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* PR treee-optimization/114894 */
+/* PR tree-optimization/114894 */
/* Phi-OPT should be able to optimize these without sinking being invoked. */
/* { dg-options "-O -fdump-tree-phiopt2 -fdump-tree-phiopt3 -fdump-tree-optimized -fno-tree-sink" } */
@@ -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/phiprop-2.c b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c
new file mode 100644
index 0000000..ae0d181
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-phiopt1 -fdump-tree-phiprop1-details" } */
+
+/* PR tree-optimization/116824 */
+
+int g(int i, int *tt)
+{
+ const int t = 10;
+ const int *a;
+ {
+ if (t < i)
+ {
+ *tt = 1;
+ a = &t;
+ }
+ else
+ {
+ *tt = 1;
+ a = &i;
+ }
+ }
+ return *a;
+}
+
+/* Check that phiprop1 can do the insert of the loads. */
+/* { dg-final { scan-tree-dump-times "Inserting PHI for result of load" 1 "phiprop1"} } */
+/* { dg-final { scan-tree-dump-times "MIN_EXPR " 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c
new file mode 100644
index 0000000..342e1c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr108358-a.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fdump-tree-optimized" } */
+
+/* PR tree-optimization/108358 */
+
+struct a {
+ int b;
+ int c;
+ short d;
+ int e;
+ int f;
+};
+struct g {
+ struct a f;
+ struct a h;
+};
+int i;
+void foo();
+void bar31_(void);
+int main() {
+ struct g j, l = {2, 1, 6, 1, 1, 7, 5, 1, 0, 1};
+ for (; i; ++i)
+ bar31_();
+ j = l;
+ struct g m = j;
+ struct g k = m;
+ if (k.h.b)
+ ;
+ else
+ foo();
+}
+/* The call to foo should be optimized away. */
+/* { dg-final { scan-tree-dump-not "foo " "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c
new file mode 100644
index 0000000..37766fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr114169-1.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-forwprop-details -fdump-tree-optimized" } */
+
+
+/* PR tree-optimization/114169 */
+
+#include <stdint.h>
+
+struct S1 {
+ uint32_t f0;
+ uint8_t f1;
+ uint64_t f2;
+ uint64_t f3;
+ int32_t f4;
+};
+
+union U8 {
+ struct S1 f0;
+ int32_t f1;
+ int64_t f2;
+ uint8_t f3;
+ const int64_t f4;
+};
+
+/* --- GLOBAL VARIABLES --- */
+struct S1 g_16 = {4294967293UL,1UL,1UL,0xA9C1C73B017290B1LL,0x5ADF851FL};
+union U8 g_37 = {{1UL,1UL,0x2361AE7D51263067LL,0xEEFD7F9B64A47447LL,0L}};
+struct S1 g_50 = {0x0CFC2012L,1UL,0x43E1243B3BE7B8BBLL,0x03C5CEC10C1A6FE1LL,1L};
+
+
+/* --- FORWARD DECLARATIONS --- */
+
+void func_32(union U8 e) {
+ e.f3 = e.f0.f4;
+ g_16 = e.f0 = g_50;
+}
+/* The union e should not make a difference here. */
+/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump "g_16 = g_50;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
new file mode 100644
index 0000000..cd9b94c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-tree-dce -fno-tree-fre" } */
+
+struct a {
+ int b;
+} const c;
+void d(const struct a f) {}
+void e(const struct a f) {
+ f.b == 0 ? 1 : f.b;
+ d(f);
+}
+int main() {
+ e(c);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c
new file mode 100644
index 0000000..fa21b8a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+void foo(int);
+void l(int**);
+int f1(int j, int t)
+{
+ int p = 0;
+ int *a = &p;
+ l(&a);
+ if (a == &p)
+ return 0;
+ for(int i = 0; i < j; i++)
+ {
+ if (a == &p) foo(p);
+ }
+ return 0;
+}
+
+/* We should be able to remove the call to foo because a is never equal to &p inside the loop. */
+/* { dg-final { scan-tree-dump-not "foo " "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c
new file mode 100644
index 0000000..d71ef5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple -O2" } */
+
+void __GIMPLE (ssa,startwith("switchlower1"))
+foo (int b)
+{
+ __BB(2):
+ switch (b) {default: L9; case 0: L5; case 5: L5; case 101: L5; }
+
+ __BB(3):
+L9:
+ switch (b) {default: L7; case 5: L6; case 101: L6; }
+
+ __BB(4):
+L6:
+ __builtin_unreachable ();
+
+ __BB(5):
+L7:
+ __builtin_trap ();
+
+ __BB(6):
+L5:
+ return;
+
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c
new file mode 100644
index 0000000..c1ce44f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c
@@ -0,0 +1,67 @@
+/* PR tree-optimization/120231 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-add-options float32 } */
+/* { dg-add-options float64 } */
+/* { dg-add-options float128 } */
+/* { dg-require-effective-target float32 } */
+/* { dg-require-effective-target float64 } */
+/* { dg-require-effective-target float128 } */
+/* { dg-final { scan-tree-dump-not "link_failure \\\(\\\);" "optimized" } } */
+
+void link_failure (void);
+
+void
+foo (_Float64 x)
+{
+ if (x >= -64.0f64 && x <= 0x1.p+140f64)
+ {
+ _Float32 z = x;
+ _Float128 w = z;
+ _Float128 v = x;
+ if (__builtin_isnan (z)
+ || __builtin_isnan (w)
+ || __builtin_isnan (v)
+ || z < -64.0f32
+ || w < -64.0f128
+ || __builtin_isinf (v)
+ || v < -64.0f128
+ || v > 0x1.p+140f128)
+ link_failure ();
+ }
+}
+
+void
+bar (_Float64 x)
+{
+ _Float32 z = x;
+ if (z >= -64.0f32 && z <= 0x1.p+38f32)
+ {
+ if (__builtin_isnan (x)
+ || __builtin_isinf (x)
+ || x < -0x1.000001p+6f64
+ || x > 0x1.000001p+38f64)
+ link_failure ();
+ }
+}
+
+void
+baz (_Float64 x)
+{
+ _Float128 w = x;
+ if (w >= -64.0f128 && w <= 0x1.p+1026f128)
+ {
+ if (__builtin_isnan (x)
+ || __builtin_isinf (x)
+ || x < -64.0f64)
+ link_failure ();
+ }
+ if (w >= 128.25f128 && w <= 0x1.p+1020f128)
+ {
+ if (__builtin_isnan (x)
+ || __builtin_isinf (x)
+ || x < 128.25f64
+ || x > 0x1.p+1020f64)
+ link_failure ();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c
new file mode 100644
index 0000000..d2b41ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-2.c
@@ -0,0 +1,107 @@
+/* PR tree-optimization/120231 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-add-options float64 } */
+/* { dg-require-effective-target float64 } */
+/* { dg-final { scan-tree-dump-not "link_failure \\\(\\\);" "optimized" } } */
+
+void link_failure (void);
+
+static _Float64 __attribute__((noinline))
+f1 (signed char x)
+{
+ return x;
+}
+
+static _Float64 __attribute__((noinline))
+f2 (signed char x)
+{
+ if (x >= -37 && x <= 42)
+ return x;
+ return 0.0f64;
+}
+
+void
+f3 (signed char x)
+{
+ _Float64 y = f1 (x);
+ if (y < (_Float64) (-__SCHAR_MAX__ - 1) || y > (_Float64) __SCHAR_MAX__)
+ link_failure ();
+ y = f2 (x);
+ if (y < -37.0f64 || y > 42.0f64)
+ link_failure ();
+}
+
+static _Float64 __attribute__((noinline))
+f4 (long long x)
+{
+ return x;
+}
+
+static _Float64 __attribute__((noinline))
+f5 (long long x)
+{
+ if (x >= -0x3ffffffffffffffeLL && x <= 0x3ffffffffffffffeLL)
+ return x;
+ return 0.0f64;
+}
+
+void
+f6 (long long x)
+{
+ _Float64 y = f4 (x);
+ if (y < (_Float64) (-__LONG_LONG_MAX__ - 1) || y > (_Float64) __LONG_LONG_MAX__)
+ link_failure ();
+ y = f5 (x);
+ if (y < (_Float64) -0x3ffffffffffffffeLL || y > (_Float64) 0x3ffffffffffffffeLL)
+ link_failure ();
+}
+
+static signed char __attribute__((noinline))
+f7 (_Float64 x)
+{
+ if (x >= -78.5f64 && x <= 98.25f64)
+ return x;
+ return 0;
+}
+
+static unsigned char __attribute__((noinline))
+f8 (_Float64 x)
+{
+ if (x >= -0.75f64 && x <= 231.625f64)
+ return x;
+ return 31;
+}
+
+static long long __attribute__((noinline))
+f9 (_Float64 x)
+{
+ if (x >= -3372587051122780362.75f64 && x <= 3955322825938799366.25f64)
+ return x;
+ return 0;
+}
+
+static unsigned long long __attribute__((noinline))
+f10 (_Float64 x)
+{
+ if (x >= 31.25f64 && x <= 16751991430751148048.125f64)
+ return x;
+ return 4700;
+}
+
+void
+f11 (_Float64 x)
+{
+ signed char a = f7 (x);
+ if (a < -78 || a > 98)
+ link_failure ();
+ unsigned char b = f8 (x);
+ if (b > 231)
+ link_failure ();
+ long long c = f9 (x);
+ if (c < -3372587051122780160LL || c > 3955322825938799616LL)
+ link_failure ();
+ unsigned long long d = f10 (x);
+ if (d < 31 || d > 16751991430751148032ULL)
+ link_failure ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c
new file mode 100644
index 0000000..d578c5b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120231-3.c
@@ -0,0 +1,40 @@
+/* PR tree-optimization/120231 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-add-options float64 } */
+/* { dg-require-effective-target float64 } */
+/* { dg-final { scan-tree-dump-not "link_failure \\\(\\\);" "optimized" } } */
+
+void link_failure (void);
+
+void
+foo (long long x)
+{
+ _Float64 y = x;
+ if (y >= -8577328745032543176.25f64 && y <= 699563045341050951.75f64)
+ {
+ if (x < -8577328745032544256LL || x > 699563045341051136LL)
+ link_failure ();
+ }
+ if (y >= -49919160463252.125f64 && y <= 757060336735329.625f64)
+ {
+ if (x < -49919160463252LL || x > 757060336735329LL)
+ link_failure ();
+ }
+}
+
+void
+bar (_Float64 x)
+{
+ long long y = x;
+ if (y >= -6923230004751524066LL && y <= 2202103129706786704LL)
+ {
+ if (x < -6923230004751524864.0f64 || x > 2202103129706786816.0f64)
+ link_failure ();
+ }
+ if (y >= -171621738469699LL && y <= 45962470357748LL)
+ {
+ if (x <= -1716217384696970.f64 || x >= 45962470357749.0f64)
+ link_failure ();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c
index 127300f..dafb4c4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c
@@ -14,8 +14,8 @@ f2 (long int b)
return (16 + (b & 7)) & 15;
}
-char
-f3 (char c)
+signed char
+f3 (signed char c)
{
return -(c & 63) & 31;
}
@@ -34,7 +34,7 @@ f5 (int e)
/* { dg-final { scan-tree-dump-times "return -a \& 7;" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "return b \& 7;" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "return \\(char\\) -\\(unsigned char\\) c \& 31;" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "return \\(signed char\\) -\\(unsigned char\\) c \& 31;" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "return \\(int\\) \\(12 - \\(unsigned int\\) d\\) \& 7;" 1 "original" { target { ! int16 } } } } */
/* { dg-final { scan-tree-dump-times "return \\(int\\) \\(12 - \\(unsigned short\\) d\\) \& 7;" 1 "original" { target { int16 } } } } */
/* { dg-final { scan-tree-dump-times "return 12 - \\(e \& 7\\) \& 15;" 1 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr35286.c b/gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
index 4429cc8..b4f8c7c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-code-hoisting -fno-tree-cselim -fdump-tree-pre-stats" } */
+/* { dg-options "-O2 -fno-code-hoisting -fno-tree-cselim -fno-ssa-phiopt -fdump-tree-pre-stats" } */
int g2;
struct A {
int a; int b;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c
new file mode 100644
index 0000000..dc4fadb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr57361-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-forwprop1-details" } */
+
+struct A { int x; double y; };
+void f (struct A *a) {
+ *a = *a;
+}
+
+/* xfailed until figuring out the best way to handle aliasing barriers. */
+/* { dg-final { scan-tree-dump "into a NOP" "forwprop1" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c b/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c
index 81f27b3..7e273db 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-dse1-details" } */
+/* { dg-options "-O -fdump-tree-dse1-details -fno-tree-forwprop" } */
struct A { int x; double y; };
void f (struct A *a) {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr78154-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr78154-2.c
new file mode 100644
index 0000000..3b2cbd8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr78154-2.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp-slim -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" { keeps_null_pointer_checks } } */
+
+void foo (void *, __SIZE_TYPE__) __attribute__((nonnull_if_nonzero (1, 2)));
+void baz (void);
+
+void
+bar (void *a, void *b, void *c, void *d, void *e, __SIZE_TYPE__ n)
+{
+ foo (a, 42);
+ if (a == 0)
+ __builtin_abort ();
+ if (n)
+ {
+ foo (b, n);
+ if (b == 0)
+ __builtin_abort ();
+ }
+ if (n >= 42)
+ {
+ foo (c, n - 10);
+ if (c == 0)
+ __builtin_abort ();
+ }
+ foo (d, 0);
+ if (d == 0)
+ baz ();
+ if (n != 42)
+ {
+ foo (e, n);
+ if (e == 0)
+ baz ();
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_abort" "evrp" } } */
+/* { dg-final { scan-tree-dump-times "baz \\\(" 2 "evrp" } } */
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/pr98265.C b/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C
deleted file mode 100644
index 9c798e6..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C
+++ /dev/null
@@ -1,348 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
-extern void __assert_fail(const char*, const char*, int, const char*);
-namespace Eigen {
-enum { AutoAlign };
-template <int, typename>
-struct conditional;
-template <typename Else>
-struct conditional<false, Else> {
- typedef Else type;
-};
-template <typename T>
-struct remove_reference {
- typedef T type;
-};
-struct is_arithmetic {
- enum { value };
-};
-template <typename>
-struct traits;
-template <typename T>
-struct traits<const T> : traits<T> {};
-template <typename>
-struct evaluator;
-template <typename>
-struct EigenBase;
-template <typename>
-class PlainObjectBase;
-template <typename, int _Rows, int _Cols, int = AutoAlign, int = _Rows,
- int = _Cols>
-class Matrix;
-template <typename>
-class MatrixBase;
-template <typename, typename>
-class CwiseNullaryOp;
-template <typename, typename, typename>
-class CwiseBinaryOp;
-template <typename>
-struct scalar_constant_op;
-template <int _Rows>
-struct size_at_compile_time {
- enum { ret = _Rows };
-};
-struct ref_selector {
- typedef const Matrix<float, 3, 1>& type;
-};
-template <typename Derived>
-struct dense_xpr_base {
- typedef MatrixBase<Derived> type;
-};
-template <typename Derived, typename = typename traits<Derived>::XprKind>
-struct generic_xpr_base {
- typedef typename dense_xpr_base<Derived>::type type;
-};
-template <typename Expr, typename Scalar = typename Expr::Scalar>
-struct plain_constant_type {
- ;
- typedef CwiseNullaryOp<scalar_constant_op<Scalar>,
- Matrix<Scalar, traits<Expr>::ColsAtCompileTime,
- traits<Expr>::MaxRowsAtCompileTime,
- traits<Expr>::MaxColsAtCompileTime>>
- type;
-};
-struct scalar_product_op {
- float operator()(float a, float b) { return a * b; }
-};
-template <typename>
-struct scalar_constant_op {
- scalar_constant_op(float other) : m_other(other) {}
- float operator()() { return m_other; }
- float m_other;
-};
-struct assign_op {
- void assignCoeff(float& a, float b) { a = b; }
-};
-template <typename Derived>
-class DenseCoeffsBase : public EigenBase<Derived> {
- public:
- typedef typename traits<Derived>::Scalar Scalar;
- typedef
- typename conditional<is_arithmetic::value, Scalar>::type CoeffReturnType;
-};
-template <typename Derived>
-class DenseBase : public DenseCoeffsBase<Derived> {
- public:
- enum {
- RowsAtCompileTime = traits<Derived>::RowsAtCompileTime,
- SizeAtCompileTime = size_at_compile_time<RowsAtCompileTime>::ret,
- MaxSizeAtCompileTime
- };
-};
-template <typename Derived>
-class MatrixBase : public DenseBase<Derived> {
- public:
- using DenseBase<Derived>::derived;
- template <typename T>
- CwiseBinaryOp<scalar_product_op, const Derived,
- const typename plain_constant_type<Derived, T>::type>
- operator*(T& scalar) {
- return CwiseBinaryOp<scalar_product_op, const Derived,
- const typename plain_constant_type<Derived>::type>(
- derived(), typename plain_constant_type<Derived>::type(derived().rows(),
- 0, scalar));
- }
-};
-template <typename Derived>
-struct EigenBase {
- const Derived& derived() const { return *static_cast<const Derived*>(this); }
- Derived& const_cast_derived() const {
- return *static_cast<Derived*>(const_cast<EigenBase*>(this));
- }
-};
-template <typename>
-struct binary_evaluator;
-template <typename T>
-struct evaluator<const T> : evaluator<T> {
- evaluator(const T& xpr) : evaluator<T>(xpr) {}
-};
-template <typename Derived>
-struct evaluator {
- typedef Derived PlainObjectType;
- typedef typename PlainObjectType::Scalar Scalar;
- evaluator(const PlainObjectType& m) : m_data(m.data()) {}
- typename PlainObjectType::CoeffReturnType coeff(long row, long) {
- return m_data[row];
- }
- Scalar& coeffRef(long row, long) { return const_cast<Scalar*>(m_data)[row]; }
- const Scalar* m_data;
-};
-template <typename Scalar, int Rows, int Cols, int Options, int MaxRows,
- int MaxCols>
-struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
- : evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols>>> {
- typedef Matrix<Scalar, Rows, Cols> XprType;
- evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType>>(m) {}
-};
-struct nullary_wrapper {
- template <typename IndexType>
- float operator()(scalar_constant_op<float> op, IndexType, IndexType) const {
- return op();
- }
-};
-template <typename NullaryOp, typename PlainObjectType>
-struct evaluator<CwiseNullaryOp<NullaryOp, PlainObjectType>> {
- typedef CwiseNullaryOp<NullaryOp, PlainObjectType> XprType;
- evaluator(XprType n) : m_functor(n.functor()) {}
- template <typename IndexType>
- typename XprType::CoeffReturnType coeff(IndexType row, IndexType col) {
- return m_wrapper(m_functor, row, col);
- }
- NullaryOp m_functor;
- nullary_wrapper m_wrapper;
-};
-template <typename BinaryOp, typename Lhs, typename Rhs>
-struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>>
- : binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
- evaluator(CwiseBinaryOp<BinaryOp, Lhs, Rhs> xpr)
- : binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>>(xpr) {}
-};
-template <typename BinaryOp, typename Lhs, typename Rhs>
-struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
- typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
- binary_evaluator(XprType xpr) : m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()) {}
- typename XprType::CoeffReturnType coeff(long row, long col) {
- return m_functor(m_lhsImpl.coeff(row, col), m_rhsImpl.coeff(row, col));
- }
- BinaryOp m_functor;
- evaluator<Lhs> m_lhsImpl;
- evaluator<Rhs> m_rhsImpl;
-};
-template <typename Kernel, int Index, int Stop>
-struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling {
- enum { outer, inner = Index };
- static void run(Kernel kernel) {
- kernel.assignCoeffByOuterInner(outer, inner);
- copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, Index + 1,
- Stop>::run(kernel);
- }
-};
-template <typename Kernel, int Stop>
-struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, Stop,
- Stop> {
- static void run(Kernel) {}
-};
-template <typename Kernel>
-struct dense_assignment_loop {
- static void run(Kernel kernel) {
- typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
- enum { size = DstXprType::SizeAtCompileTime, alignedSize = 0 };
- copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, alignedSize,
- size>::run(kernel);
- }
-};
-template <typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT,
- typename Functor>
-class generic_dense_assignment_kernel {
- typedef typename DstEvaluatorTypeT::XprType DstXprType;
-
- public:
- typedef DstEvaluatorTypeT DstEvaluatorType;
- typedef SrcEvaluatorTypeT SrcEvaluatorType;
- generic_dense_assignment_kernel(DstEvaluatorType dst, SrcEvaluatorType src,
- Functor, DstXprType& dstExpr)
- : m_dst(dst), m_src(src), m_dstExpr(dstExpr) {}
- long assignCoeff_col;
- void assignCoeffByOuterInner(long, long inner) {
- long __trans_tmp_1 = inner;
- m_functor.assignCoeff(m_dst.coeffRef(__trans_tmp_1, assignCoeff_col),
- m_src.coeff(__trans_tmp_1, assignCoeff_col));
- }
- DstEvaluatorType m_dst;
- SrcEvaluatorType m_src;
- Functor m_functor;
- DstXprType& m_dstExpr;
-};
-template <typename DstXprType, typename SrcXprType, typename Functor>
-void call_dense_assignment_loop(DstXprType& dst, SrcXprType src, Functor func) {
- typedef evaluator<DstXprType> DstEvaluatorType;
- typedef evaluator<SrcXprType> SrcEvaluatorType;
- SrcEvaluatorType srcEvaluator(src);
- DstEvaluatorType dstEvaluator(dst);
- typedef generic_dense_assignment_kernel<DstEvaluatorType, SrcEvaluatorType,
- Functor>
- Kernel;
- Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived());
- dense_assignment_loop<Kernel>::run(kernel);
-}
-template <typename Dst, typename Src, typename Func>
-void call_assignment_no_alias(Dst& dst, Src src, Func func) {
- enum { NeedToTranspose };
- typename conditional<NeedToTranspose, Dst&>::type actualDst(dst);
- CwiseBinaryOp<scalar_product_op, const Matrix<float, 3, 1>,
- const CwiseNullaryOp<scalar_constant_op<float>,
- const Matrix<float, 3, 1, 0, 2, 3>>>
- __trans_tmp_4 = src;
- call_dense_assignment_loop(actualDst, __trans_tmp_4, func);
-}
-template <int Size>
-struct plain_array {
- float array[Size];
-};
-template <int Size, int _Rows>
-class DenseStorage {
- plain_array<Size> m_data;
-
- public:
- DenseStorage() {}
- DenseStorage(const DenseStorage&);
- static long rows() { return _Rows; }
- const float* data() const { return m_data.array; }
- float* data() { return m_data.array; }
-};
-template <typename Derived>
-class PlainObjectBase : public dense_xpr_base<Derived>::type {
- public:
- typedef typename dense_xpr_base<Derived>::type Base;
- typedef typename traits<Derived>::Scalar Scalar;
- DenseStorage<Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime> m_storage;
- long rows() const { return m_storage.rows(); }
- const Scalar* data() const { return m_storage.data(); }
- PlainObjectBase() {}
- template <typename OtherDerived>
- PlainObjectBase(const DenseBase<OtherDerived>& other) {
- _set_noalias(other);
- }
- template <typename OtherDerived>
- void _set_noalias(const DenseBase<OtherDerived>& other) {
- call_assignment_no_alias(this->derived(), other.derived(), assign_op());
- }
-};
-template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
- int _MaxCols>
-struct traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>> {
- typedef _Scalar Scalar;
- typedef int XprKind;
- enum {
- RowsAtCompileTime = _Rows,
- ColsAtCompileTime,
- MaxRowsAtCompileTime,
- MaxColsAtCompileTime,
- };
-};
-template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
- int _MaxCols>
-class Matrix
- : public PlainObjectBase<
- Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>> {
- public:
- typedef PlainObjectBase<Matrix> Base;
- typedef typename traits<Matrix>::Scalar Scalar;
- Matrix(Scalar& x, Scalar& y, Scalar& z) {
- m_storage.data()[0] = x;
- m_storage.data()[1] = y;
- m_storage.data()[2] = z;
- }
- template <typename OtherDerived>
- Matrix(const EigenBase<OtherDerived>& other) : Base(other.derived()) {}
- using Base::m_storage;
-};
-template <typename BinaryOp, typename Lhs, typename Rhs>
-struct traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
- typedef typename traits<Lhs>::XprKind XprKind;
- enum { RowsAtCompileTime };
- typedef float Scalar;
-};
-template <typename>
-class CwiseBinaryOpImpl;
-template <typename, typename, typename RhsType>
-class CwiseBinaryOp : public CwiseBinaryOpImpl<RhsType> {
- public:
- typedef ref_selector::type LhsNested;
- typedef RhsType RhsNested;
- CwiseBinaryOp(const Matrix<float, 3, 1>& aLhs, RhsType& aRhs)
- : m_lhs(aLhs), m_rhs(aRhs) {}
- remove_reference<LhsNested>::type& lhs() { return m_lhs; }
- typename remove_reference<RhsNested>::type& rhs() { return m_rhs; }
- LhsNested m_lhs;
- RhsNested m_rhs;
-};
-template <typename>
-class CwiseBinaryOpImpl
- : public generic_xpr_base<CwiseBinaryOp<
- scalar_product_op, const Matrix<float, 3, 1>,
- const CwiseNullaryOp<scalar_constant_op<float>,
- const Matrix<float, 3, 1, 0, 2, 3>>>>::type {};
-template <typename NullaryOp, typename PlainObjectType>
-struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType>>
- : traits<PlainObjectType> {};
-template <typename, typename PlainObjectType>
-class CwiseNullaryOp
- : public dense_xpr_base<CwiseNullaryOp<int, PlainObjectType>>::type {
- public:
- CwiseNullaryOp(long rows, long, scalar_constant_op<float> func)
- : m_functor(func) {
- rows ? void() : __assert_fail("", "", 1, __PRETTY_FUNCTION__);
- }
- scalar_constant_op<float> functor() { return m_functor; }
- scalar_constant_op<float> m_functor;
-};
-} // namespace Eigen
-Eigen::Matrix<float, 3, 1> should_inline(float x, float y, float z,
- float scale) {
- return Eigen::Matrix<float, 3, 1>(x, y, z) * scale;
-}
-
-// We should inline everything to should_inline
-
-/* { dg-final { scan-tree-dump-times "Function" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c
index 093e7a5..545f316 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c
@@ -25,4 +25,4 @@ int main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "Optimizing range tests .* 26" 1 "reassoc1"} }*/
+/* { dg-final { scan-tree-dump-times "Optimizing range tests .* 26" 1 "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c
index fa661d9..a89e068 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c
@@ -23,4 +23,4 @@ main ()
__builtin_abort ();
return 0;
}
-/* { dg-final { scan-tree-dump-times "Optimizing range tests" 3 "reassoc1"} }*/
+/* { dg-final { scan-tree-dump-times "Optimizing range tests" 3 "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c
index a4da8f7..1c4041b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c
@@ -20,4 +20,4 @@ int main ()
__builtin_abort ();
return 0;
}
-/* { dg-final { scan-tree-dump-times "Optimizing range tests" 1 "reassoc1"} }*/
+/* { dg-final { scan-tree-dump-times "Optimizing range tests" 1 "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c
index dde5d84..a81846c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c
@@ -22,4 +22,4 @@ main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "Optimizing range tests" 1 "reassoc1"} }*/
+/* { dg-final { scan-tree-dump-times "Optimizing range tests" 1 "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c
index ffea714..a0489b9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c
@@ -21,4 +21,4 @@ int main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "Optimizing range tests" 1 "reassoc1"} }*/
+/* { dg-final { scan-tree-dump-times "Optimizing range tests" 1 "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c
index 9befe18..de75566 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c
@@ -104,4 +104,4 @@ f13 (double x)
/* Can't reassoc here. */
return bar (tmp1 * tmp2, tmp2);
}
-/* { dg-final { scan-tree-dump-times "Optimizing copysign" 12 "reassoc1"} }*/
+/* { dg-final { scan-tree-dump-times "Optimizing copysign" 12 "reassoc1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-41.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-41.c
index 8a18b88..9624c75 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-41.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-41.c
@@ -18,4 +18,4 @@ f2 (double y)
return (-1.2 * __builtin_copysign (1.1, y));
}
-/* { dg-final { scan-tree-dump-times "Optimizing copysign" 2 "reassoc1"} }*/
+/* { dg-final { scan-tree-dump-times "Optimizing copysign" 2 "reassoc1" } } */
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/split-path-6.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
index 71e6362..e2b0a95 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fdump-tree-split-paths-details -fno-finite-loops -fno-tree-dominator-opts -fno-tree-vrp -w" } */
+/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fno-ssa-phiopt -fdump-tree-split-paths-details -fno-finite-loops -fno-tree-dominator-opts -fno-tree-vrp -w" } */
struct __sFILE
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c
index 252fe06..35634ab 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fno-tree-sink -fdump-tree-split-paths-details -w" } */
+/* { dg-options "-O2 -fsplit-paths -fno-tree-cselim -fno-ssa-phiopt -fno-tree-sink -fdump-tree-split-paths-details -w" } */
struct _reent
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c
index 5c89e3f..6fa52f6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c
@@ -27,4 +27,4 @@ foo ()
but the loop reads only one element at a time, and DOM cannot resolve these.
The same happens on powerpc depending on the SIMD support available. */
-/* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail { { alpha*-*-* hppa*64*-*-* nvptx*-*-* mmix-knuth-mmixware } || { { { lp64 && { powerpc*-*-* sparc*-*-* } } || aarch64_sve } || { arm*-*-* && { ! arm_neon } } } } } } } */
+/* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail { { alpha*-*-* hppa*64*-*-* nvptx*-*-* mmix-knuth-mmixware } || { { { lp64 && { mips*-*-* powerpc*-*-* sparc*-*-* riscv*-*-* } } || aarch64_sve } || { arm*-*-* && { ! arm_neon } } } } } } } */
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..1c2cfa4 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: 8" "thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" { target { aarch64*-*-* } } } } */
enum STATE {
S0=0,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c
new file mode 100644
index 0000000..9e605ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c
@@ -0,0 +1,30 @@
+/* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre -fdump-tree-optimized" } */
+
+/* PR tree-optimization/87901 */
+
+char z[32];
+void foo1(void)
+{
+ char z1[17];
+ char z2[24];
+ __builtin_memset (z1, 0, 17);
+ __builtin_memcpy (z, z1, 17);
+ __builtin_memset (z2, 0, 24);
+ __builtin_memcpy (z+8, z2, 24);
+}
+
+/* we should get:
+ MEM <unsigned char[8]> [(char * {ref-all})&z] = {};
+ MEM <unsigned char[24]> [(char * {ref-all})&z + 8B] = {};
+ after DSE; trimming the first memset to z (which was memcpy) to 8 bytes
+ from the original 17.
+ and not have a [17] in the IR after DSE.
+ The two memset to z1/z2 will also be removed.
+ */
+/* { dg-final { scan-tree-dump-not "\\\[17\\\]" "optimized" } } */
+/* { dg-final { scan-tree-dump "\\\[8\\\]" "dse1" } } */
+
+/* { dg-final { scan-tree-dump-times "Trimming statement " 1 "dse1" } } */
+/* { dg-final { scan-tree-dump-times "Deleted dead call:" 2 "dse1" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c
new file mode 100644
index 0000000..a2df591
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fno-strict-aliasing -fdump-tree-dse-details -fno-tree-fre -fdump-tree-optimized" } */
+
+/* PR tree-optimization/87901 */
+
+
+int i;
+int foo ()
+{
+ i = 0;
+ *((short *)&i + 1) = 1;
+ return i;
+}
+
+/* we should get:
+ MEM <char[2]> [(int *)&i] = {};
+ MEM[(short int *)&i + 2B] = 1;
+ in DSE1.
+
+ Note later on the stores will be merged. */
+/* { dg-final { scan-tree-dump "return 65536;" "optimized" { target le } } } */
+/* { dg-final { scan-tree-dump "return 1;" "optimized" { target be } } } */
+/* { dg-final { scan-tree-dump "\\\[2\\\]" "dse1" } } */
+
+/* { dg-final { scan-tree-dump-times "Trimming statement " 1 "dse1" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c
new file mode 100644
index 0000000..7e79a73
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c
@@ -0,0 +1,25 @@
+/* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre -fdump-tree-optimized" } */
+
+/* PR tree-optimization/87901 */
+
+int z[128];
+void foo1(void)
+{
+ int z1;
+ int z2[24/sizeof(int)];
+ __builtin_memset (&z1, 0, sizeof(int));
+ __builtin_memcpy (z, &z1, sizeof(int));
+ __builtin_memset (z2, 0, 24);
+ __builtin_memcpy (((char*)z)+1, z2, 24);
+}
+
+/* we should get:
+ MEM[(char * {ref-all})&z] = {};
+ __builtin_memset (&MEM <int[128]> [(void *)&z + 1B], 0, 24);
+ */
+
+/* { dg-final { scan-tree-dump-not "MEM <unsigned int>" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "MEM \\\[" "dse1" } } */
+/* { dg-final { scan-tree-dump-times "Trimming statement " 1 "dse1" } } */
+/* { dg-final { scan-tree-dump-times "Deleted dead call:" 1 "dse1" } } */
+
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/switch-5.c b/gcc/testsuite/gcc.dg/tree-ssa/switch-5.c
new file mode 100644
index 0000000..b05742c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/switch-5.c
@@ -0,0 +1,60 @@
+/* { dg-do compile { target { { x86_64-*-* aarch64-*-* ia64-*-* powerpc64-*-* } && lp64 } } } */
+/* { dg-options "-O2 -fdump-tree-switchlower1" } */
+
+int f0();
+int f1();
+int f2();
+int f3();
+int f4();
+
+int foo(int a)
+{
+ switch (a)
+ {
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ return f0();
+ case 8:
+ return f1();
+ case 10:
+ case 14:
+ case 16:
+ case 18:
+ return f2();
+ case 12:
+ return f3();
+ case 20:
+ return f4();
+ }
+ return -1;
+}
+
+/* { dg-final { scan-tree-dump ";; GIMPLE switch case clusters: BT:0-8 BT:10-20" "switchlower1" } } */
+
+int bar(int a)
+{
+ switch (a)
+ {
+ case 20:
+ case 18:
+ case 16:
+ case 14:
+ return f0();
+ case 12:
+ return f1();
+ case 10:
+ case 6:
+ case 4:
+ case 2:
+ return f2();
+ case 8:
+ return f3();
+ case 0:
+ return f4();
+ }
+ return -1;
+}
+
+/* { dg-final { scan-tree-dump ";; GIMPLE switch case clusters: BT:0-10 BT:12-20" "switchlower1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/switch-6.c b/gcc/testsuite/gcc.dg/tree-ssa/switch-6.c
new file mode 100644
index 0000000..bbbc874
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/switch-6.c
@@ -0,0 +1,51 @@
+/* { dg-do compile { target { { x86_64-*-* aarch64-*-* ia64-*-* powerpc64-*-* } && lp64 } } } */
+/* { dg-options "-O2 -fdump-tree-switchlower1 -fno-jump-tables" } */
+
+/* Test that bit-test switch lowering can create cluster of size 64 (there was
+ an of-by-one error causing it to only do 63 before). */
+
+int f();
+
+int foo(int a)
+{
+ switch (a)
+ {
+ case 0:
+ case 3:
+ case 5:
+ case 7:
+ case 9:
+ case 11:
+ case 13:
+ case 15:
+ case 17:
+ case 19:
+ case 21:
+ case 23:
+ case 25:
+ case 27:
+ case 29:
+ case 31:
+ case 33:
+ case 35:
+ case 37:
+ case 39:
+ case 41:
+ case 43:
+ case 45:
+ case 47:
+ case 49:
+ case 51:
+ case 53:
+ case 55:
+ case 57:
+ case 59:
+ case 61:
+ case 63:
+ return f();
+ default:
+ return -1;
+ }
+}
+
+/* { dg-final { scan-tree-dump ";; GIMPLE switch case clusters: BT:0-63" "switchlower1" } } */
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" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp124.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp124.c
new file mode 100644
index 0000000..789b550
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp124.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+/* Test removal of trailing zero mask ranges from signed values. */
+/* Mask off the lower 4 bits of an integer. */
+#define MASK 0XF
+
+void dead (int c);
+void keep();
+
+/* A signed character should have a range something like : */
+/* int [-INF, -16][0, 0][16, 2147483632] MASK 0xfffffff0 VALUE 0x0 */
+
+int
+foo2 (int c)
+{
+ c = c & ~MASK;
+ if (c == 0)
+ return 0;
+ if (c > -16)
+ {
+ keep ();
+ if (c < 16)
+ dead (c);
+ }
+ if (c > (__INT_MAX__ & ~MASK))
+ dead (c);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "dead" "evrp" } } */