]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/59154 (internal compiler error: tree check: expected ssa_name...
authorJakub Jelinek <jakub@redhat.com>
Sat, 23 Nov 2013 14:21:46 +0000 (15:21 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 23 Nov 2013 14:21:46 +0000 (15:21 +0100)
PR tree-optimization/59154
* tree-ssa-reassoc.c (maybe_optimize_range_tests): When changing
rhs1 of a cast and new_op is invariant, fold_convert it.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Only call
simplify_conversion_from_bitmask if rhs1 is a SSA_NAME.

From-SVN: r205307

gcc/ChangeLog
gcc/tree-ssa-forwprop.c
gcc/tree-ssa-reassoc.c

index 331cbbb717f938422f7f69a7d893a3c648dbba26..d1f7f6ecab159d7eb45647b6b00614948a6b8cd0 100644 (file)
@@ -1,3 +1,11 @@
+2013-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/59154
+       * tree-ssa-reassoc.c (maybe_optimize_range_tests): When changing
+       rhs1 of a cast and new_op is invariant, fold_convert it.
+       * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Only call
+       simplify_conversion_from_bitmask if rhs1 is a SSA_NAME.
+
 2013-11-23  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/56788
index d5d3bb84f1c601f03b63f458886446d94d9e58a7..6e6d11563e553c04d263e3ef07eccfaeb80f051e 100644 (file)
@@ -3548,7 +3548,8 @@ ssa_forward_propagate_and_combine (void)
                      {
                        tree outer_type = TREE_TYPE (gimple_assign_lhs (stmt));
                        tree inner_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
-                       if (INTEGRAL_TYPE_P (outer_type)
+                       if (TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
+                           && INTEGRAL_TYPE_P (outer_type)
                            && INTEGRAL_TYPE_P (inner_type)
                            && (TYPE_PRECISION (outer_type)
                                <= TYPE_PRECISION (inner_type)))
index 9daf28f6d0701c4859326cadd6f862d3c7258046..7145559d697b58f5806c7fcd737b666bea25d787 100644 (file)
@@ -2935,9 +2935,15 @@ maybe_optimize_range_tests (gimple stmt)
                      tree new_lhs = make_ssa_name (TREE_TYPE (lhs), NULL);
                      enum tree_code rhs_code
                        = gimple_assign_rhs_code (cast_stmt);
-                     gimple g
-                       = gimple_build_assign_with_ops (rhs_code, new_lhs,
-                                                       new_op, NULL_TREE);
+                     gimple g;
+                     if (is_gimple_min_invariant (new_op))
+                       {
+                         new_op = fold_convert (TREE_TYPE (lhs), new_op);
+                         g = gimple_build_assign (new_lhs, new_op);
+                       }
+                     else
+                       g = gimple_build_assign_with_ops (rhs_code, new_lhs,
+                                                         new_op, NULL_TREE);
                      gimple_stmt_iterator gsi = gsi_for_stmt (cast_stmt);
                      gimple_set_uid (g, gimple_uid (cast_stmt));
                      gimple_set_visited (g, true);