tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert calls.
authorDaniel Berlin <dberlin@dberlin.org>
Thu, 10 Jul 2008 17:00:37 +0000 (17:00 +0000)
committerDaniel Berlin <dberlin@gcc.gnu.org>
Thu, 10 Jul 2008 17:00:37 +0000 (17:00 +0000)
2008-07-10  Daniel Berlin  <dberlin@dberlin.org>

* tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert
calls.
(eliminate): Ditto.
(execute_pre): Call loop_optimizer_finalize in early exit.

From-SVN: r137696

gcc/ChangeLog
gcc/tree-ssa-pre.c

index 96e6b134c6632348cce083bd81aa06f684a6b86c..860ef8ba286b8d12376c2a94c991e431e9cf5378 100644 (file)
@@ -1,3 +1,10 @@
+2008-07-10  Daniel Berlin  <dberlin@dberlin.org>
+
+       * tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert
+       calls.
+       (eliminate): Ditto.
+       (execute_pre): Call loop_optimizer_finalize in early exit.
+
 2008-07-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/36790
index 53c3957bf03c360c07437f7a9aa4ee7930f276c6..ecaf54c942d6e92008182d277407b6c969b53eb7 100644 (file)
@@ -2448,10 +2448,10 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
            if (!genop1)
              return NULL_TREE;
            genop1 = fold_convert (build_pointer_type (currop->type),
-               genop1);
+                                  genop1);
 
            folded = fold_build1 (currop->opcode, currop->type,
-               genop1);
+                                 genop1);
            return folded;
          }
       }
@@ -2694,10 +2694,15 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
                                                         stmts, domstmt);
              if (!genop1 || !genop2)
                return NULL_TREE;
+             genop1 = fold_convert (TREE_TYPE (nary->op[0]),
+                                    genop1);
              /* Ensure op2 is a sizetype for POINTER_PLUS_EXPR.  It
                 may be a constant with the wrong type.  */
              if (nary->opcode == POINTER_PLUS_EXPR)
                genop2 = fold_convert (sizetype, genop2);
+             else
+               genop2 = fold_convert (TREE_TYPE (nary->op[0]), genop2);
+             
              folded = fold_build2 (nary->opcode, nary->type,
                                    genop1, genop2);
            }
@@ -2709,6 +2714,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
                                                         stmts, domstmt);
              if (!genop1)
                return NULL_TREE;
+             genop1 = fold_convert (TREE_TYPE (nary->op[0]), genop1);
+
              folded = fold_build1 (nary->opcode, nary->type,
                                    genop1);
            }
@@ -3818,11 +3825,13 @@ eliminate (void)
                  else
                    gcc_unreachable ();
                }
+
              /* If there is no existing leader but SCCVN knows this
                 value is constant, use that constant.  */
              if (!sprime && is_gimple_min_invariant (VN_INFO (lhs)->valnum))
                {
-                 sprime = VN_INFO (lhs)->valnum;
+                 sprime = fold_convert (TREE_TYPE (lhs),
+                                        VN_INFO (lhs)->valnum);
 
                  if (dump_file && (dump_flags & TDF_DETAILS))
                    {
@@ -4171,7 +4180,11 @@ execute_pre (bool do_fre)
   if (!run_scc_vn (do_fre))
     {
       if (!do_fre)
-       remove_dead_inserted_code ();
+       {
+         remove_dead_inserted_code ();
+         loop_optimizer_finalize ();
+       }
+      
       return 0;
     }
   init_pre (do_fre);