diff options
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 6a16d268e6..a7c8733251 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1342,6 +1342,18 @@ non_rewritable_lvalue_p (tree lhs) tree decl = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0); if (DECL_P (decl) && DECL_SIZE (decl) == TYPE_SIZE (TREE_TYPE (lhs)) + /* If the dynamic type of the decl has larger precision than + the decl itself we can't use the decls type for SSA rewriting. */ + && ((! INTEGRAL_TYPE_P (TREE_TYPE (decl)) + || compare_tree_int (DECL_SIZE (decl), + TYPE_PRECISION (TREE_TYPE (decl))) == 0) + || (INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + && (TYPE_PRECISION (TREE_TYPE (decl)) + >= TYPE_PRECISION (TREE_TYPE (lhs))))) + /* Make sure we are not re-writing non-float copying into float + copying as that can incur normalization. */ + && (! FLOAT_TYPE_P (TREE_TYPE (decl)) + || types_compatible_p (TREE_TYPE (lhs), TREE_TYPE (decl))) && (TREE_THIS_VOLATILE (decl) == TREE_THIS_VOLATILE (lhs))) return false; } @@ -1590,9 +1602,16 @@ execute_update_addresses_taken (void) if (gimple_assign_lhs (stmt) != lhs && !useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs))) - rhs = fold_build1 (VIEW_CONVERT_EXPR, - TREE_TYPE (lhs), rhs); - + { + if (gimple_clobber_p (stmt)) + { + rhs = build_constructor (TREE_TYPE (lhs), NULL); + TREE_THIS_VOLATILE (rhs) = 1; + } + else + rhs = fold_build1 (VIEW_CONVERT_EXPR, + TREE_TYPE (lhs), rhs); + } if (gimple_assign_lhs (stmt) != lhs) gimple_assign_set_lhs (stmt, lhs); |