aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2005-02-24 18:58:04 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2005-02-24 13:58:04 -0500
commitae95537a89e5f8d5c57ede74ca84a4a4cf3d96e3 (patch)
treebd4fbe001e6ff71d9fe9fda180ebfa70ce959631 /gcc
parentab9b9d2cf3d913401a88be046afe7113e6448e66 (diff)
downloadgcc-ae95537a89e5f8d5c57ede74ca84a4a4cf3d96e3.zip
gcc-ae95537a89e5f8d5c57ede74ca84a4a4cf3d96e3.tar.gz
gcc-ae95537a89e5f8d5c57ede74ca84a4a4cf3d96e3.tar.bz2
tree-ssa-ccp.c (visit_assignment): Verify that result of VIEW_CONVERT_EXPR is_gimple_min_invariant.
* tree-ssa-ccp.c (visit_assignment): Verify that result of VIEW_CONVERT_EXPR is_gimple_min_invariant. From-SVN: r95510
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/tree-ssa-ccp.c18
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cdc5671..7677cf8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2005-02-24 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+ * tree-ssa-ccp.c (visit_assignment): Verify that result of
+ VIEW_CONVERT_EXPR is_gimple_min_invariant.
+
* print-tree.c (print_node_brief): Print LABEL_DECL_UID.
(print_node): Likewise.
Print TYPE_SIZES_GIMPLIFIED.
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 211a484..b255020 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1060,9 +1060,7 @@ visit_assignment (tree stmt, tree *output_p)
val = evaluate_stmt (stmt);
/* If the original LHS was a VIEW_CONVERT_EXPR, modify the constant
- value to be a VIEW_CONVERT_EXPR of the old constant value. This is
- valid because a VIEW_CONVERT_EXPR is valid everywhere an operand of
- aggregate type is valid.
+ value to be a VIEW_CONVERT_EXPR of the old constant value.
??? Also, if this was a definition of a bitfield, we need to widen
the constant value into the type of the destination variable. This
@@ -1073,10 +1071,18 @@ visit_assignment (tree stmt, tree *output_p)
if (TREE_CODE (orig_lhs) == VIEW_CONVERT_EXPR
&& val.lattice_val == CONSTANT)
{
- val.const_val = build1 (VIEW_CONVERT_EXPR,
- TREE_TYPE (TREE_OPERAND (orig_lhs, 0)),
- val.const_val);
+ tree w = fold (build1 (VIEW_CONVERT_EXPR,
+ TREE_TYPE (TREE_OPERAND (orig_lhs, 0)),
+ val.const_val));
+
orig_lhs = TREE_OPERAND (orig_lhs, 1);
+ if (w && is_gimple_min_invariant (w))
+ val.const_val = w;
+ else
+ {
+ val.lattice_val = VARYING;
+ val.const_val = NULL;
+ }
}
if (val.lattice_val == CONSTANT