Fix same_close_phi_node
2016-03-15 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/68809
* graphite-scop-detection.c (same_close_phi_node): Test if result types
are the same.
* gcc.dg/graphite/pr68809-2.c: New test.
* gcc.dg/graphite/pr68809.c: New test.
---
gcc/graphite-scop-detection.c | 6 ++++--
gcc/testsuite/gcc.dg/graphite/pr68809-2.c | 27 +++++++++++++++++++++++++++
gcc/testsuite/gcc.dg/graphite/pr68809.c | 28 ++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 2 deletions(-)
@@ -273,8 +273,10 @@ trivially_empty_bb_p (basic_block bb)
static inline bool
same_close_phi_node (gphi *p1, gphi *p2)
{
- return operand_equal_p (gimple_phi_arg_def (p1, 0),
- gimple_phi_arg_def (p2, 0), 0);
+ return ((TREE_TYPE (gimple_phi_result (p1))
+ == TREE_TYPE (gimple_phi_result (p2)))
+ && operand_equal_p (gimple_phi_arg_def (p1, 0),
+ gimple_phi_arg_def (p2, 0), 0));
}
static void make_close_phi_nodes_unique (basic_block bb);
new file mode 100644
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+int ae, vs, gf;
+char ue;
+
+void
+kc (char);
+
+void
+pm (void)
+{
+ unsigned int v9;
+ int td = (gf != 0);
+ while (vs)
+ {
+ kc (ue);
+ for (ae = 0; ae < 70; ++ae)
+ {
+ }
+ ae &= 4;
+ ae ^ td && ((ue = 0) != 0);
+ ++vs;
+ }
+ v9 = ue + 1;
+ ue - v9 && ((ue = 0) != 0);
+}
new file mode 100644
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+int ae, vs;
+char ue;
+
+void
+kc (char);
+
+void
+pm (void)
+{
+ unsigned int v9;
+ int gf = 0;
+ vs = 1;
+ while (vs)
+ {
+ gf -= ue;
+ kc (ue);
+ for (ae = 0; ae < 70; ++ae)
+ {
+ }
+ ae &= 4;
+ ae ^ (gf != 0) && ((ue = 0) != 0);
+ }
+ v9 = ue + 1;
+ ue - v9 && ((ue = 0) != 0);
+}