This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tuples][patch] Don't create GIMPLE_CONDs that trap


>  This (untested) patch should fix the problem.  Rafael could you try this
> one?

This is almost the same as the idea from Richard that I tested on
tuples already (attached).

I am now testing it on trunk. I had to change can_propagate_from to.

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047
Index: gcc/tree-gimple.c
===================================================================
--- gcc/tree-gimple.c	(revision 134885)
+++ gcc/tree-gimple.c	(working copy)
@@ -204,7 +204,8 @@
 bool
 is_gimple_condexpr (tree t)
 {
-  return (is_gimple_val (t) || COMPARISON_CLASS_P (t));
+  return (is_gimple_val (t) || (COMPARISON_CLASS_P (t)
+				&& !tree_could_trap_p (t)));
 }
 
 /*  Return true if T is something whose address can be taken.  */
Index: gcc/tree-eh.c
===================================================================
--- gcc/tree-eh.c	(revision 134885)
+++ gcc/tree-eh.c	(working copy)
@@ -2174,7 +2174,10 @@
 
   if (t)
     {
-      fp_operation = FLOAT_TYPE_P (t);
+      if (COMPARISON_CLASS_P (expr))
+	fp_operation = FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
+      else
+	fp_operation = FLOAT_TYPE_P (t);
       honor_trapv = INTEGRAL_TYPE_P (t) && TYPE_OVERFLOW_TRAPS (t);
     }
 
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 06e4b5a..9428e38 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1896,7 +1896,10 @@ tree_could_trap_p (tree expr)
       || TREE_CODE_CLASS (code) == tcc_binary)
     {
       t = TREE_TYPE (expr);
-      fp_operation = FLOAT_TYPE_P (t);
+      if (COMPARISON_CLASS_P (expr))
+	fp_operation = FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
+      else
+	fp_operation = FLOAT_TYPE_P (t);
       if (fp_operation)
 	{
 	  honor_nans = flag_trapping_math && !flag_finite_math_only;
diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c
index 433c294..ab16976 100644
--- a/gcc/tree-gimple.c
+++ b/gcc/tree-gimple.c
@@ -155,7 +155,8 @@ is_gimple_lvalue (tree t)
 bool
 is_gimple_condexpr (tree t)
 {
-  return (is_gimple_val (t) || COMPARISON_CLASS_P (t));
+  return (is_gimple_val (t) || (COMPARISON_CLASS_P (t)
+				&& !tree_could_trap_p (t)));
 }
 
 /*  Return true if T is something whose address can be taken.  */
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index e6402ad..5ddc243 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -251,6 +251,10 @@ can_propagate_from (tree def_stmt)
 {
   tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
 
+  /* If the rhs could trap we cannot propagate from it. */
+  if (tree_could_trap_p (rhs))
+    return false;
+
   /* If the rhs has side-effects we cannot propagate from it.  */
   if (TREE_SIDE_EFFECTS (rhs))
     return false;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]