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/20030807-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifc-6.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifc-pr44710.c44
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-split-5.c37
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21463.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-29.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp50.c36
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp51.c58
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp52.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp53.c24
33 files changed, 294 insertions, 88 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c b/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
index f9f5fb798ef..ed6f7c0d5d5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
@@ -33,5 +33,5 @@ simplify_condition (cond_p)
}
/* There should be exactly one IF conditional. */
-/* { dg-final { scan-tree-dump-times "if " 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "if " 1 "vrp1" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c b/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c
deleted file mode 100644
index dc764c3d79e..00000000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
-struct a{
- int a;
- int b;
-} a;
-int *
-t()
-{
- return (int *)&a;
-}
-/* { dg-final { scan-tree-dump "a.a" "optimized"} } */
-/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c b/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c
deleted file mode 100644
index b764187a029..00000000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
-union a
-{
- struct s1
- {
- long long a;
- long long b;
- } s1;
- struct s2
- {
- int c;
- int d;
- } s2;
- struct s3
- {
- unsigned long long e;
- unsigned long long f;
- } s3;
-} a;
-int *
-t ()
-{
- return (int *) &a;
-}
-
-/* { dg-final { scan-tree-dump "a.s2.c" "optimized"} } */
-/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
index ee3cb0ebfe5..7b07d7f488f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-1.c
@@ -15,5 +15,5 @@ void f(struct a * b, __SIZE_TYPE__ i)
c[i] = 1;
}
-/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\] =.* 1;" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\].* = 1;" 1 "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c
index 0b865245a96..b46b8ece816 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-10.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-fre-details" } */
int b;
unsigned a;
@@ -15,9 +15,8 @@ void test2(void)
}
/* The indirect load should be replaced by a load from a and a
- conversion to int. */
+ conversion to int. FRE should then be able to replace
+ the rhs of the store to b by 1. */
-/* { dg-final { scan-tree-dump "= a;" "forwprop1" } } */
-/* { dg-final { scan-tree-dump "= \\\(int\\\) " "forwprop1" } } */
-/* { dg-final { scan-tree-dump-not "= \\\*" "forwprop1" } } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
+/* { dg-final { scan-tree-dump "Replaced\[^\\n\]*with 1" "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
index fe04e66fa1a..2aefb9ace63 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-2.c
@@ -17,5 +17,5 @@ void f(__SIZE_TYPE__ i)
c[i] = 1;
}
-/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\] =.* 1;" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "t\\\[i.*\\\].* = 1;" 1 "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop?" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c
index 710bc5dd114..1b68d5a35f0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-forwprop1 -w" } */
+/* { dg-options "-O1 -fdump-tree-esra -w" } */
#define vector __attribute__((vector_size(16) ))
struct VecClass
@@ -15,7 +15,8 @@ vector float foo( vector float v )
return y.v;
}
-/* We should be able to convert the cast to a VCE in forwprop1. */
-/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "forwprop1"} } */
-/* { dg-final { cleanup-tree-dump "forwprop1" } } */
-
+/* We should be able to remove the intermediate struct and directly
+ return x. As we do not fold VIEW_CONVERT_EXPR<struct VecClass>(x).v
+ that doesn't happen right now. */
+/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "esra"} } */
+/* { dg-final { cleanup-tree-dump "esra" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c
index 4e0751f8119..fc74297242c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-8.c
@@ -12,5 +12,5 @@ int foo(struct X *q)
/* We should have propragated &q->a into (*pointer). */
/* { dg-final { scan-tree-dump-times "pointer" 0 "forwprop1"} } */
-/* { dg-final { scan-tree-dump "->a\\\[0\\\]" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "\\\[0\\\]" "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-6.c
new file mode 100644
index 00000000000..a9c5db3873f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-6.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-c -O2 -ftree-vectorize" { target *-*-* } } */
+
+static int x;
+foo (int n, int *A)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ if (A[i])
+ x = 2;
+ if (A[i + 1])
+ x = 1;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr44710.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr44710.c
new file mode 100644
index 00000000000..d4a1be8f03e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr44710.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-c -O2 -ftree-vectorize" { target *-*-* } } */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define N 64
+float arr[N];
+
+__attribute__ ((noinline))
+int foo (unsigned int n, float *min)
+{
+ unsigned int pos = 1;
+ unsigned int i;
+ float limit = N+N;
+
+ for (i = 0; i < N; i++)
+ if (arr[i] < limit)
+ {
+ pos = i + 1;
+ limit = arr[i];
+ }
+
+ *min = limit;
+ return pos;
+}
+
+int main (void)
+{
+ int i, pos;
+ float min;
+
+ for (i = 0; i < N; i++)
+ arr[i] = (float)(i);
+
+ arr[2] = -5.8;
+
+ pos = foo (N, &min);
+ if (pos != 3 || min != arr[2])
+ abort ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-5.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-5.c
new file mode 100644
index 00000000000..bf0714902a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-5.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-fnsplit -fdump-tree-optimized" } */
+
+struct a {int a,b;};
+struct a make_me_big (int a);
+struct a split_me (int a)
+{
+ struct a retval;
+ if (__builtin_expect (a!=0,1))
+ {
+ retval.a = 0;
+ retval.b = 0;
+ return retval;
+ }
+ else
+ {
+ struct a retval = make_me_big (a);
+ retval = make_me_big (a);
+ retval = make_me_big (a);
+ retval = make_me_big (a);
+ retval = make_me_big (a);
+ retval = make_me_big (a);
+ return retval;
+ }
+}
+int val;
+test()
+{
+ split_me (val);
+ split_me (val);
+ split_me (val);
+ split_me (val);
+}
+/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */
+/* { dg-final { cleanup-tree-dump "fnsplit" } } */
+/* { dg-final { scan-tree-dump "part" "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c b/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
index 9733d8f99d8..e6130bbe7bd 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+/* { dg-options "-O2 -fdump-tree-pre-stats -fdump-tree-fre" } */
#include <stddef.h>
union tree_node;
@@ -72,7 +72,9 @@ main (void)
remove_useless_vars (&unexpanded_var_list, 0);
return 0;
}
+
+/* { dg-final { scan-tree-dump-not "= unexpanded_var_list;" "fre" } } */
/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */
/* { dg-final { scan-tree-dump-times "Insertions: 2" 1 "pre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
/* { dg-final { cleanup-tree-dump "pre" } } */
-
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c
index af867515002..853fe70c623 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr17141-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-forwprop1" } */
+/* { dg-options "-O -fdump-tree-forwprop1" } */
struct A { int i; };
int
@@ -11,5 +11,7 @@ foo(struct A *locp, int str)
return locp->i;
}
-/* { dg-final { scan-tree-dump "locp.*->i =" "forwprop1" } } */
+/* We should have propagated &locp->i into its dereference. */
+
+/* { dg-final { scan-tree-dump "locp_\[^\\n\]* =" "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21463.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21463.c
index f490bf61e5a..3f63cdd8e8c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21463.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21463.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-phiprop" } */
+/* { dg-options "-O -fdump-tree-phiprop-details" } */
struct f
{
@@ -16,5 +16,5 @@ int g(int i, int c, struct f *ff, int g)
return *t;
}
-/* { dg-final { scan-tree-dump-not "\\*t" "phiprop" } } */
+/* { dg-final { scan-tree-dump-times "Inserting PHI for result of load" 1 "phiprop" } } */
/* { dg-final { cleanup-tree-dump "phiprop" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
index b61674dff3a..6db9ba0d871 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */
+/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
extern void abort (void);
struct X {
@@ -22,5 +22,5 @@ foo(int i, int j, int k, int off)
return *q;
}
-/* { dg-final { scan-tree-dump "q_., points-to vars: { k }" "alias" } } */
-/* { dg-final { cleanup-tree-dump "alias" } } */
+/* { dg-final { scan-tree-dump "q_., points-to vars: { k }" "ealias" } } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
index adb01b23165..85b96b190e2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */
+/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */
extern void abort (void);
struct X {
@@ -22,5 +22,5 @@ foo(int i, int j, int k, int off)
return *q;
}
-/* { dg-final { scan-tree-dump "q_., points-to vars: { i }" "alias" } } */
-/* { dg-final { cleanup-tree-dump "alias" } } */
+/* { dg-final { scan-tree-dump "q_., points-to vars: { i }" "ealias" } } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
index 3b23c36238e..3f4adf43483 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-21.c
@@ -21,5 +21,9 @@ int bar (void)
return q->i;
}
-/* { dg-final { scan-tree-dump-times "a.b.i" 2 "ccp1" } } */
+/* The first access is through struct A, so a.b.i is fine,
+ the second access needs to preserve the original access type struct B. */
+
+/* { dg-final { scan-tree-dump-times "a.b.i" 1 "ccp1" } } */
+/* { dg-final { scan-tree-dump-times "MEM\\\[\\\(struct B \\\*\\\)&a\\\].i" 1 "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
index ac7f068cfd1..fb4af2d484d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
@@ -15,5 +15,5 @@ int foo (void)
return *x;
}
-/* { dg-final { scan-tree-dump "a.i\\\[1\\\]" "ccp1" } } */
+/* { dg-final { scan-tree-dump "MEM\\\[\\\(int \\\*\\\)&a \\\+ 4B\\\]" "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c
index f29c4942ace..7912a57f09e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-25.c
@@ -9,6 +9,6 @@ int foo(int i)
}
/* { dg-final { scan-tree-dump "&a\\\[\[iD\]\\\." "ccp1" } } */
-/* { dg-final { scan-tree-dump "= a\\\[\[iD\]\\\." "forwprop1" } } */
+/* { dg-final { scan-tree-dump "= .*&a\\\]\\\[\[iD\]\\\." "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c
index 542c4293960..c0a548155cb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-26.c
@@ -7,5 +7,5 @@ int foo(int i)
return (a + 1)[i];
}
-/* { dg-final { scan-tree-dump "= a\\\[D\\\." "forwprop1" } } */
+/* { dg-final { scan-tree-dump "=.*&a\\\]\\\[D\\\." "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-29.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-29.c
new file mode 100644
index 00000000000..44d2945a311
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-29.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp2" } */
+
+static double num;
+int foo (void)
+{
+ return *(unsigned *)&num;
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "ccp2" } } */
+/* { dg-final { cleanup-tree-dump "ccp2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
index 0cb63242c0e..b9ec6bc720f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
@@ -11,6 +11,5 @@ int f(int *a)
return *c + t;
}
-/* { dg-final { scan-tree-dump "Replaced \\\(int \\\*\\\) b_.*with a_" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced \\\*c_.*with t_" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced \\\*a_\[^\n\].*with t_" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
index ae9eb5a2002..972e6c69ef9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c
@@ -23,6 +23,5 @@ void foo(double (*q)[4], struct Foo *tmp1)
}
}
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1_.\\\(D\\\)->data with &a" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
index 81b82fe4880..9d1b3f2ba92 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c
@@ -27,6 +27,5 @@ void foo(double (*q)[4])
bar(a);
}
-/* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
-/* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced tmp1.data with &a" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c
index 978b7abab3a..b986bdd92a9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-26.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-Os -fdump-tree-pre-details" } */
+/* { dg-options "-O -fdump-tree-fre-details" } */
typedef union
{
@@ -23,5 +23,5 @@ void foo(SA* pResult, SB* method, SC* self)
pResult->data = pResult->data;
}
-/* { dg-final { scan-tree-dump "Deleted redundant store" "pre" } } */
-/* { dg-final { cleanup-tree-dump "pre" } } */
+/* { dg-final { scan-tree-dump "Deleted redundant store" "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c
index c87f62e69c6..f87476a3a9f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c
@@ -7,6 +7,6 @@ foo (int *array)
return array[1];
return 0;
}
-/* We should eliminate one address calculation, and one load. */
-/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "fre"} } */
+/* We should eliminate one load. */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "fre"} } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
index fe41966a6d4..7caf4eec6f8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c
@@ -23,5 +23,5 @@ int vnum_test8(int *data)
}
/* We should eliminate m - n, n + k, set data[5] = 0, eliminate the
address arithmetic for data[5], and set p = 0.
-/* { dg-final { scan-tree-dump-times "Eliminated: 7" 1 "fre"} } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 5" 1 "fre"} } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
index 78e92d769e4..7dc7833647b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
@@ -1,5 +1,5 @@
/* { dg-do "compile" } */
-/* { dg-options "-O2 -fdump-tree-fre" } */
+/* { dg-options "-O2 -fdump-tree-fre-details" } */
struct S { float f; };
int __attribute__((noinline))
@@ -11,5 +11,5 @@ foo (float *r, struct S *p)
return i + *q;
}
-/* { dg-final { scan-tree-dump-times "\\\*q" 1 "fre" } } */
+/* { dg-final { scan-tree-dump "Replaced\[^\n\]*with i_." "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
index aa9e142bba0..812dac928da 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
@@ -12,7 +12,8 @@ foo ( struct S *p)
}
-/* There should only be one load of p->f because fwprop can change *(int *)&p->f into just (int)p->f. */
-/* { dg-final { scan-tree-dump-times "p_.\\\(D\\\)->f" 1 "fre" } } */
+/* There should only be one load of p->f because fwprop can change
+ *(int *)&p->f into just (int)p->f. */
+/* { dg-final { scan-tree-dump-times "= \[^\n\]*p_.\\\(D\\\)" 1 "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp50.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp50.c
new file mode 100644
index 00000000000..bf21672c61a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp50.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
+
+int
+foo (unsigned int i, unsigned int j)
+{
+ i &= 15;
+ j &= 15;
+ i += 1024;
+ j += 2048;
+ i &= j;
+ return i < 16;
+}
+
+int
+bar (int i)
+{
+ int c = 2;
+ c &= i > 6;
+ return c == 0;
+}
+
+int baz (int x, int y)
+{
+ x &= 15;
+ y &= 15;
+ x += 4;
+ y += 16;
+ x &= y;
+ return x < 20;
+}
+
+/* { dg-final { scan-tree-dump "Folding predicate i_\[^\n\r\]* to 1" "vrp1" } } */
+/* { dg-final { scan-tree-dump "Folding predicate c_\[^\n\r\]* to 1" "vrp1" } } */
+/* { dg-final { scan-tree-dump "Folding predicate x_\[^\n\r\]* to 1" "vrp1" } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp51.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp51.c
new file mode 100644
index 00000000000..66aa5ed6d6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp51.c
@@ -0,0 +1,58 @@
+/* PR tree-optimization/28632 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vrp" } */
+
+void
+v4 (unsigned a, unsigned b)
+{
+ if (a < 0x1000) return;
+ if (a > 0x1000) return;
+ if (b < 0x0110) return;
+ /* constant true. */
+ if (!__builtin_constant_p ((a|b) >= 0x01000))
+ __asm__("bug.always.true");
+ /* VRP must not think that this is constant. */
+ if (__builtin_constant_p ((a|b) >= 0x10000))
+ __asm__("bug.not.always.true");
+}
+
+void
+u4 (unsigned n)
+{
+ if (n > 0x10111) return;
+ if (n < 0x10101) return;
+ /* always true. */
+ if (!__builtin_constant_p (n & 0x00100))
+ __asm__("bug.always.true");
+ /* VRP must not think that this is constant true. */
+ if (__builtin_constant_p (n & 0x00001))
+ __asm__("bug.not.always.true");
+ /* Out of range, always evaluates to constant false. */
+ if (!__builtin_constant_p (n & 0x01000))
+ __asm__("bug.always.false");
+}
+
+void
+u5 (unsigned n)
+{
+ struct s {unsigned exp:8;} x;
+ x.exp = n;
+ if (__builtin_constant_p(((n + 1) & 255) > 1))
+ __asm__("bug.not.always.true");
+}
+
+void
+v5 (int a, int b)
+{
+ if (a < 0x1000) return;
+ if (a > 0x1000) return;
+ if (b < 0x0110) return;
+ /* constant true. */
+ if (!__builtin_constant_p ((a|b) >= 0x01000))
+ __asm__("bug.always.true");
+ /* VRP must not think that this is always true. */
+ if (__builtin_constant_p ((a|b) >= 0x10000))
+ __asm__("bug.not.always.true");
+}
+
+/* { dg-final { scan-assembler-not "bug\." } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp52.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp52.c
new file mode 100644
index 00000000000..7d530e24688
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp52.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
+
+int
+foo (unsigned int i, unsigned int j)
+{
+ i &= 15;
+ j &= 15;
+ i += 1024;
+ j += 2048;
+ i |= j;
+ return i >= 1024 + 2048;
+}
+
+/* { dg-final { scan-tree-dump "Folding predicate i_\[^\n\r\]* to 1" "vrp1" } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp53.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp53.c
new file mode 100644
index 00000000000..66bbfb67b90
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp53.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
+
+int
+f1 (int x)
+{
+ x &= 0xff;
+ x += 0x400;
+ x &= 0x7ff;
+ return x;
+}
+
+int
+f2 (int x)
+{
+ x &= 0xff;
+ x += 0x5400;
+ x |= 0x4400;
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-not "\& (2047|0x7ff)" "vrp1" } } */
+/* { dg-final { scan-tree-dump-not "\\| (17408|0x4400)" "vrp1" } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */