Commit c76a1f18 by Richard Guenther Committed by Richard Biener

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
parent c7c63407
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> 2008-08-21 Jan Hubicka <jh@suse.cz>
* cgraph.c (first_cgraph_function_insertion_hook): New variable. * cgraph.c (first_cgraph_function_insertion_hook): New variable.
......
2008-08-21 Richard Guenther <rguenther@suse.de> 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 PR middle-end/36817
* gcc.c-torture/compile/pr36817.c: New testcase. * gcc.c-torture/compile/pr36817.c: New testcase.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom1" } */ /* { dg-options "-O2 -fdump-tree-ccp1" } */
typedef unsigned char v4qi __attribute__ ((vector_size (4))); typedef unsigned char v4qi __attribute__ ((vector_size (4)));
...@@ -12,5 +12,5 @@ void foo() ...@@ -12,5 +12,5 @@ void foo()
c = a + b; c = a + b;
} }
/* { dg-final { scan-tree-dump-times "c = { 6, 8, 10, 12 }" 1 "dom1" } } */ /* { dg-final { scan-tree-dump-times "c =.* { 6, 8, 10, 12 }" 1 "ccp1" } } */
/* { dg-final { cleanup-tree-dump "dom1" } } */ /* { dg-final { cleanup-tree-dump "ccp1" } } */
...@@ -961,7 +961,17 @@ ccp_fold (gimple stmt) ...@@ -961,7 +961,17 @@ ccp_fold (gimple stmt)
} }
if (kind == tcc_reference) 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) else if (kind == tcc_declaration)
return get_symbol_constant_value (rhs); return get_symbol_constant_value (rhs);
return rhs; return rhs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment