+2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/47271
+ * tree-if-conv.c (bb_postdominates_preds): New.
+ (if_convertible_bb_p): Call bb_postdominates_preds.
+ (if_convertible_loop_p_1): Compute CDI_POST_DOMINATORS.
+ (predicate_scalar_phi): Call bb_postdominates_preds.
+
2011-01-25 Nick Clifton <nickc@redhat.com>
* config/rx/rx.h (LIBCALL_VALUE): Do not promote complex types.
+2011-01-25 Sebastian Pop <sebastian.pop@amd.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/47271
+ * gcc.dg/tree-ssa/ifc-pr47271.c: New.
+
2011-01-25 Nick Clifton <nickc@redhat.com>
* gcc.target/rx/builtins.c: Allow -fipa-cp-clone.
--- /dev/null
+/* { dg-options "-O3" } */
+/* { dg-do run } */
+
+extern void abort (void);
+
+void func (void)
+{
+ int i;
+ int nops;
+ char *codestr =
+ "|\000\000Ee\000\000Z\001\000d\000\000Z\002\000d\025\000Z\003\000"
+ "\t\t\t\t\t\t\t\t\t\t\t\td\026\000Z\004\000d\005\000\204\000\000Z"
+ "\005\000e\006\000e\a\000j\005\000e\b\000d\006\000\204\002\000\203"
+ "\001\000Z\t\000d\a\000\204\000\000Z\n\000d\b\000\204\000\000Z\v\000d"
+ "\t\000\204\000\000Z\f\000d\n\000\204\000\000Z\r\000e\016\000e\017\000d"
+ "\v\000\203\001\000d\f\000d\r\000\203\001\001Z\020\000e\016\000e\017"
+ "\000d\016\000\203\001\000d\f\000d\017\000\203\001\001Z\021\000e\016"
+ "\000e\017\000d\020\000\203\001\000d\f\000d\021\000\203\001\001Z\022"
+ "\000e\016\000e\017\000d\022\000\203\001\000d\f\000d\023\000\203\001"
+ "\001Z\023\000d\024\000S";
+ int codelen = 209;
+ int addrmap[500];
+
+ for (i=0, nops=0 ; i<codelen ; i += ((codestr[i] >= 90) ? 3 : 1))
+ {
+ addrmap[i] = i - nops;
+ if (codestr[i] == 9)
+ nops++;
+ }
+
+ if (addrmap[0] != 0
+ || addrmap[3] != 3
+ || addrmap[4] != 4
+ || addrmap[7] != 7
+ || addrmap[10] != 10
+ || addrmap[13] != 13
+ || addrmap[16] != 16
+ || addrmap[19] != 19
+ || addrmap[22] != 22
+ || addrmap[23] != 22
+ || addrmap[24] != 22)
+ abort ();
+}
+
+int main ()
+{
+ func ();
+ return 0;
+}
return true;
}
+/* Return true when BB post-dominates all its predecessors. */
+
+static bool
+bb_postdominates_preds (basic_block bb)
+{
+ unsigned i;
+
+ for (i = 0; i < EDGE_COUNT (bb->preds); i++)
+ if (!dominated_by_p (CDI_POST_DOMINATORS, EDGE_PRED (bb, i)->src, bb))
+ return false;
+
+ return true;
+}
+
/* Return true when BB is if-convertible. This routine does not check
basic block's statements and phis.
return false;
}
+ if (EDGE_COUNT (bb->preds) == 2
+ && bb != loop->header
+ && !bb_postdominates_preds (bb))
+ return false;
+
return true;
}
return false;
calculate_dominance_info (CDI_DOMINATORS);
+ calculate_dominance_info (CDI_POST_DOMINATORS);
/* Allow statements that can be handled during if-conversion. */
ifc_bbs = get_loop_body_in_if_conv_order (loop);
arg_1 = gimple_phi_arg_def (phi, 1);
}
+ gcc_checking_assert (bb == bb->loop_father->header
+ || bb_postdominates_preds (bb));
+
/* Build new RHS using selected condition and arguments. */
rhs = build3 (COND_EXPR, TREE_TYPE (res),
unshare_expr (cond), arg_0, arg_1);