diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-01-15 16:33:24 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2013-01-15 16:33:24 +0000 |
commit | ffb676f4b94d86af05f84c6aa5c5819cd2028fe1 (patch) | |
tree | 233c3be517e334266d67afb8bd40f84a91531a62 /gcc/tree-sra.c | |
parent | 17b838c1db68ad0d26f4fccd0f1114c309e6c768 (diff) |
PR tree-optimization/55920
* tree-sra.c (sra_modify_assign): If for lacc->grp_to_be_debug_replaced
there is non-useless type conversion needed from debug rhs to lhs,
use build_debug_ref_for_model and/or VIEW_CONVERT_EXPR.
* gcc.c-torture/compile/pr55920.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@195209 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 367e32b69c8..e5fbcf2c5c5 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -3108,8 +3108,20 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi) if (lacc && lacc->grp_to_be_debug_replaced) { - gimple ds = gimple_build_debug_bind (get_access_replacement (lacc), - unshare_expr (rhs), *stmt); + tree dlhs = get_access_replacement (lacc); + tree drhs = unshare_expr (rhs); + if (!useless_type_conversion_p (TREE_TYPE (dlhs), TREE_TYPE (drhs))) + { + if (AGGREGATE_TYPE_P (TREE_TYPE (drhs)) + && !contains_vce_or_bfcref_p (drhs)) + drhs = build_debug_ref_for_model (loc, drhs, 0, lacc); + if (drhs + && !useless_type_conversion_p (TREE_TYPE (dlhs), + TREE_TYPE (drhs))) + drhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, + TREE_TYPE (dlhs), drhs); + } + gimple ds = gimple_build_debug_bind (dlhs, drhs, *stmt); gsi_insert_before (gsi, ds, GSI_SAME_STMT); } |