/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-cselim-details" } */
+/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */
void
f (int *a, int b)
*a |= 1;
}
-/* { dg-final { scan-tree-dump-times "Conditional store replacement happened" 1 "cselim"} } */
+/* { dg-final { scan-tree-dump-times "Conditional store replacement happened" 1 "phiopt1"} } */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details -fno-ssa-phiopt" } */
unsigned test(unsigned k, unsigned b) {
unsigned a[2];
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-phiopt1-details" } */
+
+unsigned test(unsigned k, unsigned b) {
+ unsigned a[2];
+ if (b < a[k]) {
+ a[k] = b;
+ }
+ return a[0]+a[1];
+}
+
+/* { dg-final { scan-tree-dump "Conditional store replacement" "phiopt1" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-phiopt1-details" } */
int c;
unsigned test(unsigned k, unsigned b) {
return a[0]+a[1];
}
-/* { dg-final { scan-tree-dump "Conditional store replacement" "cselim" } } */
+/* { dg-final { scan-tree-dump "Conditional store replacement" "phiopt1" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details -fno-ssa-phiopt" } */
int test(int b, int k) {
struct {
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-phiopt1-details" } */
+
+int test(int b, int k) {
+ struct {
+ int data[2];
+ } a;
+
+ if (b < a.data[k]) {
+ a.data[k] = b;
+ }
+
+ return a.data[0] + a.data[1];
+}
+
+/* { dg-final { scan-tree-dump "Conditional store replacement" "phiopt1" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details -fno-ssa-phiopt" } */
int test(int b, int k) {
typedef struct {
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-phiopt1-details" } */
+
+int test(int b, int k) {
+ typedef struct {
+ int x;
+ } SS;
+ struct {
+ SS data[2];
+ } a;
+
+ if (b < a.data[k].x) {
+ a.data[k].x = b;
+ }
+
+ return a.data[0].x + a.data[1].x;
+}
+
+/* { dg-final { scan-tree-dump "Conditional store replacement" "phiopt1" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-phiopt1-details" } */
typedef union {
int i;
return u->i;
}
-/* { dg-final { scan-tree-dump "Conditional store replacement" "cselim" } } */
+/* { dg-final { scan-tree-dump "Conditional store replacement" "phiopt1" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-phiopt1-details" } */
void f (int*);
f (&x);
}
-/* { dg-final { scan-tree-dump "Conditional store replacement happened" "cselim" } } */
+/* { dg-final { scan-tree-dump "Conditional store replacement happened" "phiopt1" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-pre-stats -fno-tree-cselim" } */
+/* { dg-options "-O2 -fdump-tree-pre-stats -fno-tree-cselim -fno-ssa-phiopt" } */
typedef union {
int i;
}
if (!single_pred_p (bb1))
break;
+ if (!diamond_p && get_virtual_phi (merge)
+ && cond_store_replacement_limited (bb1, merge, bb2,
+ e1, e2, false))
+ {
+ changed = true;
+ do_over = true;
+ continue;
+ }
gphi_iterator gsi;
for (gsi = gsi_start_phis (merge); !gsi_end_p (gsi); gsi_next (&gsi))
{