From 4679504c63fdc21e4c8580c6057ff55de41975b4 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 24 Apr 2008 06:53:47 +0200 Subject: [PATCH] re PR rtl-optimization/36006 (invalid rtl sharing with -O2) PR rtl-optimization/36006 * expmed.c (store_fixed_bit_field): Copy op0 rtx before moving temp to op0 in order to avoid invalid rtx sharing. testsuite/ChangeLog: PR rtl-optimization/36006 * gfortran.dg/pr36006-1.f90: New test. * gfortran.dg/pr36006-2.f90: Ditto. From-SVN: r134618 --- gcc/ChangeLog | 58 +++++++++++-------------- gcc/expmed.c | 5 ++- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/gfortran.dg/pr36006-1.f90 | 23 ++++++++++ gcc/testsuite/gfortran.dg/pr36006-2.f90 | 13 ++++++ 5 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr36006-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr36006-2.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cab2723422a..057c7dce215 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-04-24 Uros Bizjak + + PR rtl-optimization/36006 + * expmed.c (store_fixed_bit_field): Copy op0 rtx before moving + temp to op0 in order to avoid invalid rtx sharing. + 2008-04-23 Paolo Bonzini * tree-cfg.c (verify_expr): Check with is_gimple_address. Don't @@ -74,37 +80,25 @@ 2008-04-22 Tomas Bily - * tree-cfg.c (verify_expr): Check for NON_LVALUE_EXPR as unreachable - case. - - * tree-vrp.c (extract_range_from_unary_expr): Removed unused - NON_LVALUE_EXPR. - - * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise. - - * tree-ssa-structalias.c (get_constraint_for): Likewise. - - * tree-inline.c (estimate_num_insns_1): Likewise. - - * varasm.c (const_hash_1, compare_constant, copy_constant) - (compute_reloc_for_constant, output_addressed_constants): Likewise. - - * emit-rtl.c (component_ref_for_mem_expr) - (set_mem_attributes_minus_bitpos): Likewise. - - * expr.c (highest_pow2_factor, expand_expr_real_1, ) - (is_aligning_offset): Likewise. - - * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info): Likewise. - - * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise. - - * dojump.c (do_jump): Likewise. - - * builtins.c (get_pointer_alignment, get_memory_rtx) - (integer_valued_real_p, fold_builtin_next_arg): Likewise. - - * tree-scalar-evolution.c (instantiate_parameters_1): Likewise. + * tree-cfg.c (verify_expr): Check for NON_LVALUE_EXPR as + unreachable case. + * tree-vrp.c (extract_range_from_unary_expr): Removed unused + NON_LVALUE_EXPR. + * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise. + * tree-ssa-structalias.c (get_constraint_for): Likewise. + * tree-inline.c (estimate_num_insns_1): Likewise. + * varasm.c (const_hash_1, compare_constant, copy_constant) + (compute_reloc_for_constant, output_addressed_constants): Likewise. + * emit-rtl.c (component_ref_for_mem_expr) + (set_mem_attributes_minus_bitpos): Likewise. + * expr.c (highest_pow2_factor, expand_expr_real_1, ) + (is_aligning_offset): Likewise. + * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info): Likewise. + * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise. + * dojump.c (do_jump): Likewise. + * builtins.c (get_pointer_alignment, get_memory_rtx) + (integer_valued_real_p, fold_builtin_next_arg): Likewise. + * tree-scalar-evolution.c (instantiate_parameters_1): Likewise. 2008-04-23 Jakub Jelinek @@ -250,7 +244,7 @@ df_entry_block_defs_collect, df_exit_block_uses_collect): Added mode parameter to calls to df_ref_record, df_uses_record, df_ref_create_structure. - (df_ref_equal_p, df_ref_compare): Added test for modes. + (df_ref_equal_p, df_ref_compare): Added test for modes. (df_ref_create_structure): Added code to set mode. Renamed DF_REF_WIDTH and DF_REF_OFFSET to DF_REF_EXTRACT_WIDTH and DF_REF_EXTRACT_OFFSET. diff --git a/gcc/expmed.c b/gcc/expmed.c index d5d2d528ca0..5268b318f8d 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -976,7 +976,10 @@ store_fixed_bit_field (rtx op0, unsigned HOST_WIDE_INT offset, } if (op0 != temp) - emit_move_insn (op0, temp); + { + op0 = copy_rtx (op0); + emit_move_insn (op0, temp); + } } /* Store a bit field that is split across multiple accessible memory objects. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b73ce752a8b..a11dc7aefa9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-04-24 Francois-Xavier Coudert + + PR rtl-optimization/36006 + * gfortran.dg/pr36006-1.f90: New test. + * gfortran.dg/pr36006-2.f90: Ditto. + 2008-04-23 Jerry DeLisle PR fortran/35994 diff --git a/gcc/testsuite/gfortran.dg/pr36006-1.f90 b/gcc/testsuite/gfortran.dg/pr36006-1.f90 new file mode 100644 index 00000000000..ad33d947d14 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr36006-1.f90 @@ -0,0 +1,23 @@ +! { dg-do compile } +! +subroutine test4 + integer, parameter :: wp = 4 + complex(wp), parameter :: i = (0._wp, 1._wp) + complex(wp) :: c(12) + integer :: m, N + + N = 12 + c = (/(exp(i*m),m=1,N)/) + print *, c(1) +end + +subroutine test8 + integer, parameter :: wp = 8 + complex(wp), parameter :: i = (0._wp, 1._wp) + complex(wp) :: c(12) + integer :: m, N + + N = 12 + c = (/(exp(i*m),m=1,N)/) + print *, c(1) +end diff --git a/gcc/testsuite/gfortran.dg/pr36006-2.f90 b/gcc/testsuite/gfortran.dg/pr36006-2.f90 new file mode 100644 index 00000000000..f422e09a860 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr36006-2.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-require-effective-target fortran_large_real } +! +subroutine test_large + integer, parameter :: wp = selected_real_kind (precision (0.0_8) + 1) + complex(wp), parameter :: i = (0._wp, 1._wp) + complex(wp) :: c(12) + integer :: m, N + + N = 12 + c = (/(exp(i*m),m=1,N)/) + print *, c(1) +end -- 2.30.2