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/bit_op_cvt.1.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.2.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.3.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.4.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.5.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.6.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.h13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-43.c171
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phiprop-3.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phiprop-4.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phiprop-5.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phiprop-6.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phiprop-7.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr119683.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr122478.c17
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr122588-1.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr122629-1.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr46555.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr92834.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/scev-16.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-1.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-2.c57
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-3.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-4.c30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-5.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-6.c42
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-7.c36
37 files changed, 949 insertions, 13 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.1.c b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.1.c
new file mode 100644
index 0000000..c0da601
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.1.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include "bit_op_cvt.h"
+
+DEF_BIT_CVT_0(uint8_t, int8_t, uint16_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, int8_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, int8_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint16_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int16_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, int8_t, int16_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, int8_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint8_t, int8_t, int64_t, |, bit_ior)
+
+DEF_BIT_CVT_0(uint16_t, int16_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint16_t, int16_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint16_t, int16_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint16_t, int16_t, int64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint16_t, uint16_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint16_t, uint16_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint16_t, uint16_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(uint16_t, uint16_t, int64_t, |, bit_ior)
+
+DEF_BIT_CVT_0(uint32_t, int32_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint32_t, int32_t, int64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint32_t, uint32_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(uint32_t, uint32_t, int64_t, |, bit_ior)
+
+/* { dg-final { scan-tree-dump-not "_\[0-9]\+ = \\(u?int\[0-9]\+_t\\) _\[0-9]\+;\\s+return _\[0-9]\+;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.2.c b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.2.c
new file mode 100644
index 0000000..38671d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.2.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include "bit_op_cvt.h"
+
+DEF_BIT_CVT_0(int8_t, int8_t, uint16_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, int8_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, int8_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint16_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, uint8_t, int16_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, uint8_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, uint8_t, int64_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, int8_t, int16_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, int8_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(int8_t, int8_t, int64_t, |, bit_ior)
+
+DEF_BIT_CVT_0(int16_t, int16_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(int16_t, int16_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(int16_t, int16_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(int16_t, int16_t, int64_t, |, bit_ior)
+DEF_BIT_CVT_0(int16_t, uint16_t, uint32_t, |, bit_ior)
+DEF_BIT_CVT_0(int16_t, uint16_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(int16_t, uint16_t, int32_t, |, bit_ior)
+DEF_BIT_CVT_0(int16_t, uint16_t, int64_t, |, bit_ior)
+
+DEF_BIT_CVT_0(int32_t, int32_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(int32_t, int32_t, int64_t, |, bit_ior)
+DEF_BIT_CVT_0(int32_t, uint32_t, uint64_t, |, bit_ior)
+DEF_BIT_CVT_0(int32_t, uint32_t, int64_t, |, bit_ior)
+
+/* { dg-final { scan-tree-dump-not "_\[0-9]\+ = \\(u?int\[0-9]\+_t\\) _\[0-9]\+;\\s+return _\[0-9]\+;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.3.c b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.3.c
new file mode 100644
index 0000000..8439345
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.3.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include "bit_op_cvt.h"
+
+DEF_BIT_CVT_0(uint8_t, int8_t, uint16_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, int8_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, int8_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint16_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int16_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int64_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, int8_t, int16_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, int8_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(uint8_t, int8_t, int64_t, &, bit_and)
+
+DEF_BIT_CVT_0(uint16_t, int16_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(uint16_t, int16_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(uint16_t, int16_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(uint16_t, int16_t, int64_t, &, bit_and)
+DEF_BIT_CVT_0(uint16_t, uint16_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(uint16_t, uint16_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(uint16_t, uint16_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(uint16_t, uint16_t, int64_t, &, bit_and)
+
+DEF_BIT_CVT_0(uint32_t, int32_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(uint32_t, int32_t, int64_t, &, bit_and)
+DEF_BIT_CVT_0(uint32_t, uint32_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(uint32_t, uint32_t, int64_t, &, bit_and)
+
+/* { dg-final { scan-tree-dump-not "_\[0-9]\+ = \\(u?int\[0-9]\+_t\\) _\[0-9]\+;\\s+return _\[0-9]\+;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.4.c b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.4.c
new file mode 100644
index 0000000..3f3356b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.4.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include "bit_op_cvt.h"
+
+DEF_BIT_CVT_0(int8_t, int8_t, uint16_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, int8_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, int8_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint16_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, uint8_t, int16_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, uint8_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, uint8_t, int64_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, int8_t, int16_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, int8_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(int8_t, int8_t, int64_t, &, bit_and)
+
+DEF_BIT_CVT_0(int16_t, int16_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(int16_t, int16_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(int16_t, int16_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(int16_t, int16_t, int64_t, &, bit_and)
+DEF_BIT_CVT_0(int16_t, uint16_t, uint32_t, &, bit_and)
+DEF_BIT_CVT_0(int16_t, uint16_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(int16_t, uint16_t, int32_t, &, bit_and)
+DEF_BIT_CVT_0(int16_t, uint16_t, int64_t, &, bit_and)
+
+DEF_BIT_CVT_0(int32_t, int32_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(int32_t, int32_t, int64_t, &, bit_and)
+DEF_BIT_CVT_0(int32_t, uint32_t, uint64_t, &, bit_and)
+DEF_BIT_CVT_0(int32_t, uint32_t, int64_t, &, bit_and)
+
+/* { dg-final { scan-tree-dump-not "_\[0-9]\+ = \\(u?int\[0-9]\+_t\\) _\[0-9]\+;\\s+return _\[0-9]\+;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.5.c b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.5.c
new file mode 100644
index 0000000..e746d6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.5.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include "bit_op_cvt.h"
+
+DEF_BIT_CVT_0(uint8_t, int8_t, uint16_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, int8_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, int8_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint16_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, uint8_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int16_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, uint8_t, int64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, int8_t, int16_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, int8_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint8_t, int8_t, int64_t, ^, bit_xor)
+
+DEF_BIT_CVT_0(uint16_t, int16_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint16_t, int16_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint16_t, int16_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint16_t, int16_t, int64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint16_t, uint16_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint16_t, uint16_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint16_t, uint16_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint16_t, uint16_t, int64_t, ^, bit_xor)
+
+DEF_BIT_CVT_0(uint32_t, int32_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint32_t, int32_t, int64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint32_t, uint32_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(uint32_t, uint32_t, int64_t, ^, bit_xor)
+
+/* { dg-final { scan-tree-dump-not "_\[0-9]\+ = \\(u?int\[0-9]\+_t\\) _\[0-9]\+;\\s+return _\[0-9]\+;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.6.c b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.6.c
new file mode 100644
index 0000000..a12dc88
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.6.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include "bit_op_cvt.h"
+
+DEF_BIT_CVT_0(int8_t, int8_t, uint16_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, int8_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, int8_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint16_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, uint8_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, uint8_t, int16_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, uint8_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, uint8_t, int64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, int8_t, int16_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, int8_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int8_t, int8_t, int64_t, ^, bit_xor)
+
+DEF_BIT_CVT_0(int16_t, int16_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int16_t, int16_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int16_t, int16_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int16_t, int16_t, int64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int16_t, uint16_t, uint32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int16_t, uint16_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int16_t, uint16_t, int32_t, ^, bit_xor)
+DEF_BIT_CVT_0(int16_t, uint16_t, int64_t, ^, bit_xor)
+
+DEF_BIT_CVT_0(int32_t, int32_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int32_t, int32_t, int64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int32_t, uint32_t, uint64_t, ^, bit_xor)
+DEF_BIT_CVT_0(int32_t, uint32_t, int64_t, ^, bit_xor)
+
+/* { dg-final { scan-tree-dump-not "_\[0-9]\+ = \\(u?int\[0-9]\+_t\\) _\[0-9]\+;\\s+return _\[0-9]\+;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.h b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.h
new file mode 100644
index 0000000..87d67e6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bit_op_cvt.h
@@ -0,0 +1,13 @@
+#ifndef HAVE_DEFINED_BIT_OP_CVT
+#define HAVE_DEFINED_BIT_OP_CVT
+
+#include <stdint.h>
+
+#define DEF_BIT_CVT_0(T1, T2, T3, OP, NAME) \
+T1 test_bit_##NAME##_##T1##_##T2##_##T3##_0(T2 a, \
+ T3 b) \
+{ \
+ return (T1)(a OP (T3)b); \
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c
new file mode 100644
index 0000000..5d72597
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+typedef unsigned long BITMAP_WORD;
+
+bool
+bmp_iter_set (BITMAP_WORD bits, unsigned *bit_no)
+{
+ /* If our current word is nonzero, it contains the bit we want. */
+ if (bits)
+ {
+ while (!(bits & 1))
+ {
+ bits >>= 1;
+ *bit_no += 1;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
index 3cd166a..fa8b7f3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-char.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
index b9afe88..5ebc321 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-char.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
index d2702a6..0ce4b6b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-int.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
index 1ea0d5d..f98bec0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzll } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
index 80fb02d..8edb372 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-complement-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzl } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
index 7f63493..2bf3ae6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-int.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_INT__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
index 924f61b..2e15948 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzll } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
index 178945d..2e3be65 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ctz-long.c
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ctzl } */
-/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__ * __SIZEOF_LONG__)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-43.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-43.c
new file mode 100644
index 0000000..bfda376
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-43.c
@@ -0,0 +1,171 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-forwprop1" } */
+/* { dg-require-effective-target stdint_types } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-fgimple" } */
+
+#include <stdint.h>
+
+typedef int32_t int32x4_t __attribute__((vector_size(16)));
+typedef int32_t int32x2_t __attribute__((vector_size(8)));
+typedef int32_t int32x1_t __attribute__((vector_size(4)));
+
+int32x4_t __GIMPLE (ssa)
+foo (int32x4_t x)
+{
+ int32x2_t _1;
+ int32x2_t _2;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64);
+ _2 = __BIT_FIELD_REF <int32x2_t> (x, 64, 0);
+ _6 = _Literal (int32x4_t) { _1, _2 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo2 (int32x4_t x)
+{
+ int32x1_t _1;
+ int32x1_t _2;
+ int32x1_t _3;
+ int32x1_t _4;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64);
+ _2 = __BIT_FIELD_REF <int32x1_t> (x, 32, 96);
+ _3 = __BIT_FIELD_REF <int32x1_t> (x, 32, 0);
+ _4 = __BIT_FIELD_REF <int32x1_t> (x, 32, 32);
+ _6 = _Literal (int32x4_t) { _1, _2, _3, _4 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo3 (int32x4_t x, int32x4_t y)
+{
+ int32x2_t _1;
+ int32x2_t _2;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64);
+ _2 = __BIT_FIELD_REF <int32x2_t> (y, 64, 0);
+ _6 = _Literal (int32x4_t) { _1, _2 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo4 (int32x4_t x, int32x4_t y)
+{
+ int32x1_t _1;
+ int32x1_t _2;
+ int32x1_t _3;
+ int32x1_t _4;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64);
+ _2 = __BIT_FIELD_REF <int32x1_t> (y, 32, 96);
+ _3 = __BIT_FIELD_REF <int32x1_t> (x, 32, 0);
+ _4 = __BIT_FIELD_REF <int32x1_t> (y, 32, 32);
+ _6 = _Literal (int32x4_t) { _1, _2, _3, _4 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo5 (int32x4_t x)
+{
+ int32x2_t _1;
+ int32x2_t _2;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64);
+ _2 = _Literal (int32x2_t) { 1, 2 };
+ _6 = _Literal (int32x4_t) { _1, _2 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo6 (int32x4_t x, int32_t y)
+{
+ int32x2_t _1;
+ int32x2_t _2;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64);
+ _2 = _Literal (int32x2_t) { y, y };
+ _6 = _Literal (int32x4_t) { _1, _2 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo7 (int32x4_t x)
+{
+ int32x2_t _1;
+ int32x2_t _2;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64);
+ _2 = _Literal (int32x2_t) { 1, 2 };
+ _6 = _Literal (int32x4_t) { _2, _1 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo8 (int32x4_t x, int32_t y)
+{
+ int32x2_t _1;
+ int32x2_t _2;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64);
+ _2 = _Literal (int32x2_t) { y, y };
+ _6 = _Literal (int32x4_t) { _2, _1 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo9 (int32x4_t x)
+{
+ int32x1_t _1;
+ int32x1_t _2;
+ int32x1_t _3;
+ int32x1_t _4;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 96);
+ _2 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64);
+ _3 = _Literal (int32x1_t) { 1 };
+ _4 = _Literal (int32x1_t) { 1 };
+ _6 = _Literal (int32x4_t) { _3, _4, _1, _2 };
+ return _6;
+}
+
+int32x4_t __GIMPLE (ssa)
+foo10 (int32x4_t x, int32_t y)
+{
+ int32x1_t _1;
+ int32x1_t _2;
+ int32x1_t _3;
+ int32x1_t _4;
+ int32x4_t _6;
+
+__BB(2):
+ _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 96);
+ _2 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64);
+ _3 = _Literal (int32x1_t) { y };
+ _4 = _Literal (int32x1_t) { y };
+ _6 = _Literal (int32x4_t) { _3, _4, _1, _2 };
+
+ return _6;
+}
+
+
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 10 "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phiprop-3.c b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-3.c
new file mode 100644
index 0000000..59e9561
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-3.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-phiprop1-details" } */
+
+/* PR tree-optimization/60183 */
+
+unsigned char c;
+extern unsigned char d;
+int j = 2;
+
+unsigned long
+foo (void)
+{
+ unsigned char *y = &c;
+ int i;
+ unsigned w = 0;
+ for (i = 0; i < j; i++)
+ {
+ w = *y;
+ y = &d;
+ }
+ return w;
+}
+/* the load from c/d does not trap so we should able to remove the phi. */
+/* { dg-final { scan-tree-dump "Removing dead stmt:" "phiprop1"} } */
+/* { dg-final { scan-tree-dump "Inserting PHI for result of load" "phiprop1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phiprop-4.c b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-4.c
new file mode 100644
index 0000000..ceb03ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-4.c
@@ -0,0 +1,26 @@
+/* { dg-do compile { target { weak_undefined } } } */
+/* { dg-options "-O1 -fdump-tree-phiprop1-details" } */
+/* { dg-add-options weak_undefined } */
+
+/* PR tree-optimization/60183 */
+
+unsigned char c;
+extern unsigned char d __attribute__((weak));
+int j = 2;
+
+unsigned long
+foo (void)
+{
+ unsigned char *y = &c;
+ int i;
+ unsigned w = 0;
+ for (i = 0; i < j; i++)
+ {
+ w = *y;
+ y = &d;
+ }
+ return w;
+}
+/* the load from d can trap so this should not cause a phiprop. */
+/* { dg-final { scan-tree-dump-not "Removing dead stmt:" "phiprop1"} } */
+/* { dg-final { scan-tree-dump-not "Inserting PHI for result of load" "phiprop1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phiprop-5.c b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-5.c
new file mode 100644
index 0000000..b76b17c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-5.c
@@ -0,0 +1,26 @@
+/* { dg-do compile { target { weak_undefined } } } */
+/* { dg-options "-O1 -fdump-tree-phiprop1-details" } */
+/* { dg-add-options weak_undefined } */
+
+/* PR tree-optimization/60183 */
+
+unsigned char c;
+extern unsigned char d __attribute__((weak));
+int j = 2;
+
+unsigned long
+foo (void)
+{
+ unsigned char *y = &c;
+ int i;
+ unsigned w = 0;
+ for (i = 0; i < *y; i++)
+ {
+ w = *y;
+ y = &d;
+ }
+ return w;
+}
+/* the load from d can trap but the load always happen so this should be done. */
+/* { dg-final { scan-tree-dump "Removing dead stmt:" "phiprop1"} } */
+/* { dg-final { scan-tree-dump "Inserting PHI for result of load" "phiprop1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phiprop-6.c b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-6.c
new file mode 100644
index 0000000..8561cd1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-6.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { weak_undefined } } } */
+/* { dg-options "-O2 -fdump-tree-phiprop-details" } */
+/* { dg-add-options weak_undefined } */
+
+/* PR tree-optimization/116835 */
+
+extern int a __attribute__((weak));
+int b;
+
+int
+bar (int c)
+{
+ int *p = &a;
+ for (int j = 0; j < c; ++j)
+ p = &b;
+ return *p;
+}
+/* The weak load is conditional with the loop so we cannot make it unconditional. */
+/* { dg-final { scan-tree-dump-not "Removing dead stmt:" "phiprop1"} } */
+/* { dg-final { scan-tree-dump-not "Inserting PHI for result of load" "phiprop1"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phiprop-7.c b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-7.c
new file mode 100644
index 0000000..ebce03e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phiprop-7.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { weak_undefined } } } */
+/* { dg-options "-O2 -fdump-tree-phiprop-details" } */
+/* { dg-add-options weak_undefined } */
+
+/* PR tree-optimization/116835 */
+
+extern int a __attribute__((weak));
+int b;
+
+int
+bar (int c)
+{
+ int *p = &a;
+ for (int j = 0; j < *p; ++j)
+ p = &b;
+ return *p;
+}
+/* The weak load is unconditional due to the conditional so we can remove it unconditionally. */
+/* { dg-final { scan-tree-dump "Removing dead stmt:" "phiprop1"} } */
+/* { dg-final { scan-tree-dump "Inserting PHI for result of load" "phiprop1"} } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr119683.c b/gcc/testsuite/gcc.dg/tree-ssa/pr119683.c
new file mode 100644
index 0000000..631ab43
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr119683.c
@@ -0,0 +1,19 @@
+/* PR tree-optimization/119683 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times " = c_\[0-9]*\\\(D\\\) \\\+ \(?:\[0-9-]\)+;" 3 "optimized" } } */
+
+unsigned
+foo (signed char c)
+{
+ if (c >= '0' && c <= '9')
+ return c - '0';
+
+ if (c >= 'a' && c <= 'z')
+ return c - 'a' + 10;
+
+ if (c >= 'A' && c <= 'Z')
+ return c - 'A' + 10;
+
+ return -1;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c b/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c
new file mode 100644
index 0000000..a39c91b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr122478.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-additional-options "-fgimple" } */
+
+unsigned char __GIMPLE (ssa)
+foo (unsigned short mask__701)
+{
+ _Bool _19;
+ unsigned char _180;
+
+__BB(2):
+ _19 = __BIT_FIELD_REF <_Bool> (mask__701, 1, 12);
+ _180 = __VIEW_CONVERT<unsigned char>(_19);
+ return _180;
+}
+
+/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr122588-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr122588-1.c
new file mode 100644
index 0000000..2c214c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr122588-1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fgimple" } */
+/* PR tree-optimization/122588 */
+
+/* The removal of unreachable blocks should not
+ change blocks which have already become true/false.
+ The function below was is an example of that. And
+ forwprop does not go into non-executable blocks
+ so the statement `t = _1;` was still holding the
+ old reference. */
+
+int t;
+
+__GIMPLE(ssa,startwith("forwprop4")) void g(void)
+{
+ int _1;
+ __BB(2):
+ _1 = 1;
+ if (_1 != 0)
+ goto __BB3;
+ else
+ goto __BB4;
+
+ __BB(3):
+ __builtin_unreachable ();
+
+ __BB(4):
+ t = _1;
+ return;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr122629-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr122629-1.c
new file mode 100644
index 0000000..a80d4a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr122629-1.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-ifcvt-details" } */
+/* PR tree-optimization/122629 */
+
+typedef int ix4 __attribute__((vector_size(4*sizeof(int))));
+
+int f(ix4 *a, int l, int *b, ix4 *c)
+{
+ for (int i =0 ;i < l; i++)
+ {
+ int t;
+ ix4 tt = a[i];
+ ix4 tt1 = c[i];
+ if(*b) t = tt1[0]; else t = tt[0];
+ *b = t;
+ }
+}
+
+int g(ix4 *a, int l, int *b, ix4 *c)
+{
+ for (int i =0 ;i < l; i++)
+ {
+ ix4 tt = a[i];
+ ix4 tt1 = c[i];
+ if(*b) {
+ tt = tt1;
+ tt[0] = 1;
+ } else {
+ tt[0] = 1;
+ }
+ a[i] = tt;
+ }
+}
+
+/* Make sure BIT_INSERT_EXPR/BIT_FIELD_REF is still factored out for the case if operand 0 is different. */
+/* { dg-final { scan-tree-dump-times "changed to factor operation out from" 2 "ifcvt" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c b/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c
new file mode 100644
index 0000000..d4de7c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized-details -fdump-rtl-pro_and_epilogue" } */
+/* PR tree-optimization/46555 */
+/* Here should not remove the forwarder block (or rather recreate it and not
+ remove it again). This improves expansion to RTL as there is one less copy
+ (or constant formation) in some cases. In this case we also get the ability
+ to shrink wrap the function. */
+
+int h(void);
+int f(int a, int b, int c)
+{
+ if (a)
+ return 2;
+ h();
+ if (b)
+ return 2;
+ h();
+ if (c)
+ return 2;
+ h();
+ return 4;
+}
+
+/* { dg-final { scan-tree-dump-times "New forwarder block for edge" 1 "optimized" } } */
+/* Make sure we only have a PHI with 2 arguments here, 2 and 4. */
+/* { dg-final { scan-tree-dump "PHI <2..., 4...>|PHI <4..., 2...>" "optimized" } } */
+/* Make sure we can shrink wrap the function now too. */
+/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { target { { { i?86-*-* x86_64-*-* } && { ! ia32 } } || { powerpc*-*-* aarch64*-*-* riscv*-*-* arm*-*-* } } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c b/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c
index 889048d..70acf74 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr92834.c
@@ -1,8 +1,8 @@
/* PR tree-optimization/92834 */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
-/* { dg-final { scan-tree-dump-times "MIN_EXPR <" 8 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "MAX_EXPR <" 8 "optimized" } } */
+/* { dg-options "-O2 -fdump-tree-phiopt1" } */
+/* { dg-final { scan-tree-dump-times "MIN_EXPR <" 16 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR <" 16 "phiopt1" } } */
static inline unsigned
umax1 (unsigned a, unsigned b)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-16.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-16.c
new file mode 100644
index 0000000..0cc7f70
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-16.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-sccp" } */
+
+extern char a[];
+int foo ()
+{
+ int cnt = 0;
+ char *aend = a + 32;
+ char *a0 = a;
+ do
+ {
+ a0 = a0 + 16;
+ cnt++;
+ }
+ while (aend - a0 > 12);
+ return cnt;
+}
+
+/* { dg-final { scan-tree-dump "return 2" "sccp" } } */
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 1c2cfa4..81bb7fc 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: 8" "thread2" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" { target { aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 12" "thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 12" "thread2" { target { aarch64*-*-* } } } } */
enum STATE {
S0=0,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-1.c
new file mode 100644
index 0000000..6612a88
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-1.c
@@ -0,0 +1,32 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+int ga = 1;
+int gb = 2;
+int gc = 3;
+volatile int gi;
+
+static const int *vars[3] = {&ga, &gb, &gc};
+
+void link_error (void);
+
+[[gnu::noinline]] void foo (int index)
+{
+ const int *p = vars[index];
+ if (!p)
+ link_error ();
+ else
+ gi = *p;
+}
+
+[[gnu::noipa]] int
+get_index (void)
+{
+ return 1;
+}
+
+int main (int argc, char **argv)
+{
+ foo (get_index ());
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-2.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-2.c
new file mode 100644
index 0000000..0f7677d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-2.c
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+enum comp_cat_tag
+{
+ cc_partial_ordering,
+ cc_weak_ordering,
+ cc_strong_ordering,
+ cc_last
+};
+
+struct comp_cat_info_t
+{
+ const char *name;
+ const char *members[4];
+};
+
+static const struct comp_cat_info_t comp_cat_info[cc_last]
+= {
+ { "partial_ordering", { "equivalent", "greater", "less", "unordered" } },
+ { "weak_ordering", { "equivalent", "greater", "less" } },
+ { "strong_ordering", { "equal", "greater", "less" } }
+};
+
+volatile const char *gp;
+
+[[gnu::noipa]] static void
+check (const char *p)
+{
+ if (!p)
+ __builtin_abort ();
+ gp = p;
+}
+
+[[gnu::noinline]] int foo (enum comp_cat_tag tag)
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ const char *p = comp_cat_info[tag].members[i];
+ if (!p)
+ continue;;
+ check (p);
+ }
+ return 0;
+}
+
+[[gnu::noipa]] enum comp_cat_tag
+get_index (void)
+{
+ return cc_strong_ordering;
+}
+
+int main (int argc, char **argv)
+{
+ foo (get_index ());
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-3.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-3.c
new file mode 100644
index 0000000..d7a5e61
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-3.c
@@ -0,0 +1,30 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+volatile int gi;
+
+static const int values[3] = {5, 7, 11};
+
+void link_error (void);
+
+[[gnu::noinline]] void foo (int index)
+{
+ const int v = values[index];
+ if (v <= 2
+ || v > 11)
+ link_error ();
+ else
+ gi = v;
+}
+
+[[gnu::noipa]] int
+get_index (void)
+{
+ return 1;
+}
+
+int main (int argc, char **argv)
+{
+ foo (get_index ());
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-4.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-4.c
new file mode 100644
index 0000000..333a24b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-4.c
@@ -0,0 +1,30 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+volatile int gi;
+
+static const int values[25] = {5, 7, 11};
+
+void link_error (void);
+
+[[gnu::noinline]] void foo (int index)
+{
+ const int v = values[index];
+ if (v <= -2
+ || v > 11)
+ link_error ();
+ else
+ gi = v;
+}
+
+[[gnu::noipa]] int
+get_index (void)
+{
+ return 1;
+}
+
+int main (int argc, char **argv)
+{
+ foo (get_index ());
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-5.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-5.c
new file mode 100644
index 0000000..08e2117
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-5.c
@@ -0,0 +1,36 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+volatile int gi;
+
+static const struct {
+ int a;
+ int b;
+} values[2][2] = {
+ { {1000, 1 }, {1001, 2} },
+ { {1003, 1 }, {1004, 2} }
+};
+
+void link_error (void);
+
+[[gnu::noinline]] void foo (int i, int j)
+{
+ const int v = values[i][j].b;
+ if (v <= 0
+ || v > 2)
+ link_error ();
+ else
+ gi = v;
+}
+
+[[gnu::noipa]] int
+get_index (void)
+{
+ return 1;
+}
+
+int main (int argc, char **argv)
+{
+ foo (get_index (), get_index ());
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-6.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-6.c
new file mode 100644
index 0000000..6f93f09
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-6.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+volatile int gi;
+
+static const struct {
+ int a;
+ int b;
+} values[2][2] = {
+ { {0, 1 }, {0, 2} },
+ { {0, 1 }, {0, 2} }
+};
+
+[[gnu::noipa]] static void
+check (int v)
+{
+ if (!v)
+ __builtin_abort ();
+ gi = v;
+}
+
+
+[[gnu::noinline]] void foo (int i, int j)
+{
+ const int v = values[i][j].a;
+ if (v <= 0
+ || v > 2)
+ return;
+ check (v);
+}
+
+[[gnu::noipa]] int
+get_index (void)
+{
+ return 1;
+}
+
+int main (int argc, char **argv)
+{
+ foo (get_index (), get_index ());
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-7.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-7.c
new file mode 100644
index 0000000..da01abb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-from-cst-agg-7.c
@@ -0,0 +1,36 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+volatile int gi;
+
+static const struct {
+ int a;
+ int b;
+} values[2][2] = {
+ { {1000, 1 }, {1001, 2} },
+ { {1003, 1 }, {1004, 2} }
+};
+
+void link_error (void);
+
+[[gnu::noinline]] void foo (int i)
+{
+ const int v = values[0][i].b;
+ if (v <= 0
+ || v > 2)
+ link_error ();
+ else
+ gi = v;
+}
+
+[[gnu::noipa]] int
+get_index (void)
+{
+ return 1;
+}
+
+int main (int argc, char **argv)
+{
+ foo (get_index ());
+ return 0;
+}