]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants.
authorRichard Guenther <rguenther@suse.de>
Thu, 21 Aug 2008 16:15:08 +0000 (16:15 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 21 Aug 2008 16:15:08 +0000 (16:15 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-fold-1.c
gcc/tree-ssa-ccp.c

index d63db92b9acb359f07c5c188b9d739dd6ebb0845..d29b385e39a42f3e66c851c0221a4b0f8fd6ef27 100644 (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.
index 4cade5a92a0eb40324f49eb3d1cc5373506cce87..74ed9f9a2bbc422609dde37e81cf11492438d698 100644 (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
index 88b68b7cf4a3911d1ea9fa0923cfae166e3277a6..8aca1e42063d712756c323925f39c752ea7289b8 100644 (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" } } */
index cd50ad45941ed320ff55faed4d47357dc9235b86..57aa473481c7a0c6ad3c98ca03862ea02a516446 100644 (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;