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
This commit is contained in:
Richard Guenther 2008-08-21 16:15:08 +00:00 committed by Richard Biener
parent c7c6340790
commit c76a1f1838
4 changed files with 22 additions and 4 deletions

View file

@ -1,3 +1,7 @@
2008-08-21 Richard Guenther <rguenther@suse.de>
* tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants.
2008-08-21 Jan Hubicka <jh@suse.cz>
* cgraph.c (first_cgraph_function_insertion_hook): New variable.

View file

@ -1,3 +1,7 @@
2008-08-21 Richard Guenther <rguenther@suse.de>
* gcc.dg/vect/vect-fold-1.c: Scan ccp1 dump instead of dom1.
2008-08-21 Richard Guenther <rguenther@suse.de>
PR middle-end/36817

View file

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom1" } */
/* { dg-options "-O2 -fdump-tree-ccp1" } */
typedef unsigned char v4qi __attribute__ ((vector_size (4)));
@ -12,5 +12,5 @@ void foo()
c = a + b;
}
/* { dg-final { scan-tree-dump-times "c = { 6, 8, 10, 12 }" 1 "dom1" } } */
/* { dg-final { cleanup-tree-dump "dom1" } } */
/* { dg-final { scan-tree-dump-times "c =.* { 6, 8, 10, 12 }" 1 "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */

View file

@ -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;