diff options
author | Richard Guenther <rguenther@suse.de> | 2008-08-21 16:15:08 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-08-21 16:15:08 +0000 |
commit | c76a1f1838c73fdf4caa61e776bfcdc9afabb408 (patch) | |
tree | 1ade2292fbb0e32211932a86c3ef59a327851403 /gcc/tree-ssa-ccp.c | |
parent | c7c6340790771cf22e77dc2be248ecd03aa722fe (diff) | |
download | gcc-c76a1f1838c73fdf4caa61e776bfcdc9afabb408.zip gcc-c76a1f1838c73fdf4caa61e776bfcdc9afabb408.tar.gz gcc-c76a1f1838c73fdf4caa61e776bfcdc9afabb408.tar.bz2 |
tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants.
2008-08-21 Richard Guenther <rguenther@suse.de>
* tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants.
* gcc.dg/vect/vect-fold-1.c: Scan ccp1 dump instead of dom1.
From-SVN: r139398
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index cd50ad4..57aa473 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -961,7 +961,17 @@ ccp_fold (gimple stmt) } if (kind == tcc_reference) - return fold_const_aggregate_ref (rhs); + { + if (TREE_CODE (rhs) == VIEW_CONVERT_EXPR + && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME) + { + prop_value_t *val = get_value (TREE_OPERAND (rhs, 0)); + if (val->lattice_val == CONSTANT) + return fold_unary (VIEW_CONVERT_EXPR, + TREE_TYPE (rhs), val->value); + } + return fold_const_aggregate_ref (rhs); + } else if (kind == tcc_declaration) return get_symbol_constant_value (rhs); return rhs; |