summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-24 18:58:04 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-24 18:58:04 +0000
commiteb71604319e040a4a8aa8521159c342af0cc675c (patch)
treebd4fbe001e6ff71d9fe9fda180ebfa70ce959631 /gcc/tree-ssa-ccp.c
parent3ebe371ac6ab22c04f2b7164d5804d621db5eb85 (diff)
downloadgcc-eb71604319e040a4a8aa8521159c342af0cc675c.tar.gz
* tree-ssa-ccp.c (visit_assignment): Verify that result of
VIEW_CONVERT_EXPR is_gimple_min_invariant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95510 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 211a484b8a9..b255020917f 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