aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-11-29 01:08:41 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-11-28 20:08:41 -0500
commit9390c347e9f2ac5dc3a97933f537c1576a310f4e (patch)
treeb482d08649ec8d47fb095b9196547e3f66709af8 /gcc/tree-ssa-ccp.c
parentab1a8620fc5bef59dec0bb8b7b41cea4132435d5 (diff)
downloadgcc-9390c347e9f2ac5dc3a97933f537c1576a310f4e.zip
gcc-9390c347e9f2ac5dc3a97933f537c1576a310f4e.tar.gz
gcc-9390c347e9f2ac5dc3a97933f537c1576a310f4e.tar.bz2
tree-ssa-operands.c (build_ssa_operands, [...]): Ignore a VIEW_CONVERT_EXPR on LHS when deciding if must or may def.
PR/18664 * tree-ssa-operands.c (build_ssa_operands, case MODIFY_EXPR): Ignore a VIEW_CONVERT_EXPR on LHS when deciding if must or may def. * tree-ssa-ccp.c (visit_assignment): If LHS is a VIEW_CONVERT_EXPR, add an inverse VIEW_CONVERT_EXPR to const_val. From-SVN: r91450
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 31807fe..911e573 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1053,21 +1053,35 @@ visit_assignment (tree stmt, tree *output_p)
val = *nval;
}
else
- {
- /* Evaluate the statement. */
+ /* Evaluate the statement. */
val = evaluate_stmt (stmt);
- }
- /* FIXME: Hack. If this was a definition of a bitfield, we need to widen
+ /* 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.
+
+ ??? Also, if this was a definition of a bitfield, we need to widen
the constant value into the type of the destination variable. This
should not be necessary if GCC represented bitfields properly. */
{
- tree lhs = TREE_OPERAND (stmt, 0);
+ tree orig_lhs = TREE_OPERAND (stmt, 0);
+
+ 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);
+ orig_lhs = TREE_OPERAND (orig_lhs, 1);
+ }
+
if (val.lattice_val == CONSTANT
- && TREE_CODE (lhs) == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND (lhs, 1)))
+ && TREE_CODE (orig_lhs) == COMPONENT_REF
+ && DECL_BIT_FIELD (TREE_OPERAND (orig_lhs, 1)))
{
- tree w = widen_bitfield (val.const_val, TREE_OPERAND (lhs, 1), lhs);
+ tree w = widen_bitfield (val.const_val, TREE_OPERAND (orig_lhs, 1),
+ orig_lhs);
if (w && is_gimple_min_invariant (w))
val.const_val = w;