summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-07 11:33:03 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-07 11:33:03 +0000
commitf5faab844106d746903455717a480387ae1f0083 (patch)
treef52c4c351d6548f9f04017536c937c708d92d3ed
parentfb60e6351aef88dc33fa5feef1287143be21d996 (diff)
downloadgcc-f5faab844106d746903455717a480387ae1f0083.tar.gz
2013-11-07 Richard Biener <rguenther@suse.de>
* tree-ssa-ccp.c (canonicalize_float_value): Rename to ... (canonicalize_value): ... this. Also handle stripping of TREE_OVERFLOW. (get_value, set_lattice_value, get_value_for_expr): Adjust. * gimple-fold.c (canonicalize_constructor_val): Strip TREE_OVERFLOW. * tree-ssa-threadedge.c (set_ssa_name_value): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204506 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/gimple-fold.c2
-rw-r--r--gcc/tree-ssa-ccp.c23
-rw-r--r--gcc/tree-ssa-threadedge.c2
4 files changed, 29 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fa1d74bdcd0..72dd1c2b3e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
2013-11-07 Richard Biener <rguenther@suse.de>
+ * tree-ssa-ccp.c (canonicalize_float_value): Rename to ...
+ (canonicalize_value): ... this. Also handle stripping of
+ TREE_OVERFLOW.
+ (get_value, set_lattice_value, get_value_for_expr): Adjust.
+ * gimple-fold.c (canonicalize_constructor_val): Strip
+ TREE_OVERFLOW.
+ * tree-ssa-threadedge.c (set_ssa_name_value): Likewise.
+
+2013-11-07 Richard Biener <rguenther@suse.de>
+
* tree-dfa.c (get_ref_base_and_extent): Fix casting.
2013-11-07 H.J. Lu <hongjiu.lu@intel.com>
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 844b65b0bf2..a4be3aae4d5 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -205,6 +205,8 @@ canonicalize_constructor_val (tree cval, tree from_decl)
cval = fold_convert (TREE_TYPE (orig_cval), cval);
return cval;
}
+ if (TREE_OVERFLOW_P (cval))
+ return drop_tree_overflow (cval);
return orig_cval;
}
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 5b6c0dbea28..b4dfd4928cd 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -168,7 +168,7 @@ typedef struct prop_value_d prop_value_t;
static prop_value_t *const_val;
static unsigned n_const_val;
-static void canonicalize_float_value (prop_value_t *);
+static void canonicalize_value (prop_value_t *);
static bool ccp_fold_stmt (gimple_stmt_iterator *);
/* Dump constant propagation value VAL to file OUTF prefixed by PREFIX. */
@@ -326,7 +326,7 @@ get_value (tree var)
if (val->lattice_val == UNINITIALIZED)
*val = get_default_value (var);
- canonicalize_float_value (val);
+ canonicalize_value (val);
return val;
}
@@ -378,17 +378,24 @@ set_value_varying (tree var)
that HONOR_NANS is false, and we try to change the value of x to 0,
causing an ICE. With HONOR_NANS being false, the real appearance of
NaN would cause undefined behavior, though, so claiming that y (and x)
- are UNDEFINED initially is correct. */
+ are UNDEFINED initially is correct.
+
+ For other constants, make sure to drop TREE_OVERFLOW. */
static void
-canonicalize_float_value (prop_value_t *val)
+canonicalize_value (prop_value_t *val)
{
enum machine_mode mode;
tree type;
REAL_VALUE_TYPE d;
- if (val->lattice_val != CONSTANT
- || TREE_CODE (val->value) != REAL_CST)
+ if (val->lattice_val != CONSTANT)
+ return;
+
+ if (TREE_OVERFLOW_P (val->value))
+ val->value = drop_tree_overflow (val->value);
+
+ if (TREE_CODE (val->value) != REAL_CST)
return;
d = TREE_REAL_CST (val->value);
@@ -454,7 +461,7 @@ set_lattice_value (tree var, prop_value_t new_val)
/* We can deal with old UNINITIALIZED values just fine here. */
prop_value_t *old_val = &const_val[SSA_NAME_VERSION (var)];
- canonicalize_float_value (&new_val);
+ canonicalize_value (&new_val);
/* We have to be careful to not go up the bitwise lattice
represented by the mask.
@@ -569,7 +576,7 @@ get_value_for_expr (tree expr, bool for_bits_p)
val.lattice_val = CONSTANT;
val.value = expr;
val.mask = double_int_zero;
- canonicalize_float_value (&val);
+ canonicalize_value (&val);
}
else if (TREE_CODE (expr) == ADDR_EXPR)
val = get_value_from_alignment (expr);
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index c3e7bd0d138..4cff16d6846 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -58,6 +58,8 @@ set_ssa_name_value (tree name, tree value)
{
if (SSA_NAME_VERSION (name) >= ssa_name_values.length ())
ssa_name_values.safe_grow_cleared (SSA_NAME_VERSION (name) + 1);
+ if (value && TREE_OVERFLOW_P (value))
+ value = drop_tree_overflow (value);
ssa_name_values[SSA_NAME_VERSION (name)] = value;
}