This patch relaxes the checks from gimple_could_trap_p in order to
allow the flag_loop_if_convert_stores to if-convert more loops
in which it is possible to prove that:
- the accesses to an array in a loop do not trap (more than the
original non-if-converted loop). This is true when the memory
accesses are executed at every iteration of the if-converted loop.
- the writes to memory occur on arrays that are not const qualified.
This is true when there exists at least one unconditional write to
the array in the analyzed program. In this patch this analysis is
limited to the loop to be if-converted.
* gimple.c (gimple_could_trap_p_1): Not static anymore.
Pass an extra bool parameter include_mem.
(gimple_could_trap_p): Adjust call to gimple_could_trap_p_1.
(gimple_assign_rhs_could_trap_p): Same.
* gimple.h (gimple_could_trap_p_1): Declared.
* tree-data-ref.h (same_data_refs_base_objects): New.
(same_data_refs): New.
* tree-if-conv.c (memrefs_read_or_written_unconditionally): New.
(write_memrefs_written_at_least_once): New.
(ifcvt_memrefs_wont_trap): New.
(operations_could_trap): New.
(ifcvt_could_trap_p): New.
(if_convertible_gimple_assign_stmt_p): Call ifcvt_could_trap_p.
Gets a vector of data refs.
(if_convertible_stmt_p): Same.
(if_convertible_loop_p_1): New.
(if_convertible_loop_p): Call if_convertible_loop_p_1.
* gcc.dg/tree-ssa/ifc-5.c: New.
From-SVN: r163531
This patch adds a flag that controls the replacement of the memory
writes that are in predicated basic blocks with a full write:
for (...)
if (cond)
A[i] = foo
is replaced with:
for (...)
A[i] = cond ? foo : A[i]
In order to do this, we have to call gimple_could_trap_p instead of
gimple_assign_rhs_could_trap_p, as we have to also check that the LHS
of assign stmts does not trap.
* common.opt (ftree-loop-if-convert-stores): New flag.
* doc/invoke.texi (ftree-loop-if-convert-stores): Documented.
* tree-if-conv.c (ifc_temp_var): Pass an extra parameter GSI. Insert
the created statement before GSI.
(if_convertible_phi_p): Allow virtual phi nodes when
flag_loop_if_convert_stores is set.
(if_convertible_gimple_assign_stmt_p): Allow memory reads and writes
Do not handle types that do not match is_gimple_reg_type.
Remove loop and bb parameters. Call gimple_could_trap_p instead of
when flag_loop_if_convert_stores is set, as LHS can contain
memory refs.
(if_convertible_stmt_p): Remove loop and bb parameters. Update calls
to if_convertible_gimple_assign_stmt_p.
(if_convertible_loop_p): Update call to if_convertible_stmt_p.
(replace_phi_with_cond_gimple_assign_stmt): Renamed
predicate_scalar_phi. Do not handle virtual phi nodes.
(ifconvert_phi_nodes): Renamed predicate_all_scalar_phis.
Call predicate_scalar_phi.
(insert_gimplified_predicates): Insert the gimplified predicate of a BB
just after the labels for flag_loop_if_convert_stores, otherwise
insert the predicate in the end of the BB.
(predicate_mem_writes): New.
(combine_blocks): Call predicate_all_scalar_phis. When
flag_loop_if_convert_stores is set, call predicate_mem_writes.
(tree_if_conversion): Call mark_sym_for_renaming when
flag_loop_if_convert_stores is set.
(main_tree_if_conversion): Return TODO_update_ssa_only_virtuals when
flag_loop_if_convert_stores is set.
* gcc.dg/tree-ssa/ifc-4.c: New.
* gcc.dg/tree-ssa/ifc-7.c: New.
From-SVN: r163530
* tree-flow.h (may_be_nonaddressable_p): New definition. Make the
existing static function global.
*tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): This function
is changed to global.
*tree-ssa-loop-prefetch.c (gather_memory_references_ref): Call
may_be_nonaddressable_p on base, and don't collect this reference
if the address of the base could not be taken.
From-SVN: r163475
2010-08-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/45366
* resolve.c (resolve_procedure_interface): New function split off from
'resolve_symbol'.
(resolve_formal_arglist): Call it here ...
(resolve_symbol): ... and here.
2010-08-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/45366
* gfortran.dg/proc_ptr_29.f90: New.
From-SVN: r163468
* configure.ac (AC_C_BIGENDIAN, AC_TYPE_UINTPTR_T): New tests.
(ssize_t): Check via AC_TYPE_SSIZE_T instead of AC_CHECK_TYPE.
(ptrdiff_t): Check via AC_CHECK_TYPE.
* config.in, configure: Rebuild.
* system.h: Include stdint.h, if available.
* lex.c (WORDS_BIGENDIAN): Provide default.
(acc_char_mask_misalign, acc_char_replicate, acc_char_cmp,
acc_char_index, search_line_acc_char, repl_chars, search_line_mmx,
search_line_sse2, search_line_sse42, init_vectorized_lexer,
search_line_fast): New.
(_cpp_clean_line): Use search_line_fast. Restructure the fast
loop to make it clear when we're leaving the loop. Stay in the
fast loop for non-trigraph '?'.
Co-Authored-By: Andi Kleen <ak@linux.intel.com>
Co-Authored-By: David S. Miller <davem@davemloft.net>
From-SVN: r163446
* tree-pass.h (pass_ipa_cdtor_merge): New function.
* cgraphunit.c (static_ctors, static_dtors): Move to ipa.c; make
heap allocated.
(record_cdtor_fn): Move to ipa.c; do not test for
have_ctors_dtors.
(build_cdtor): Move to ipa.c; add code avoiding construction
when target have ctors/dtors and there is only one ctor/dtor at given
priority.
(compare_ctor, compare_dtor): Move to ipa.c; use DECL_UID to stabilize sort;
reverse order of constructors.
(cgraph_build_cdtor_fns):Move to ipa.c; rename to build_cdtor_fns.
(cgraph_finalize_function): Do not call record_cdtor_fn.
(cgraph_finalize_compilation_unit): Do not call cgraph_build_cdtor_fns.
(cgraph_build_static_cdtor): Move to ipa.c.
* ipa.c: Include target.h and tree-iterator.h.
(cgraph_build_static_cdtor, static_ctors, static_dtors,
record_cdtor_fn, build_cdtor, compare_ctor, compare_dtor,
build_cdtor_fns, ipa_cdtor_merge, gate_ipa_cdtor_merge,
pass_ipa_cdtor_merge): New.
* passes.c (init_optimization_passes): Enqueue pass_ipa_cdtor_merge.
* ipa-prop.c (update_indirect_edges_after_inlining): Avoid out of bounds access.
From-SVN: r163443
2010-08-21 Tobias Burnus <burnus@net-b.de>
PR fortran/36158
PR fortran/33197
* intrinsic.c (add_sym): Init value attribute.
(set_attr_value): New function.
(add_functions) Use it and add JN/YN resolvers.
* symbol.c (gfc_copy_formal_args_intr): Copy value attr.
* intrinsic.h (gfc_resolve_bessel_n2): New prototype.
* gfortran.h (gfc_intrinsic_arg): Add value attribute.
* iresolve.c (gfc_resolve_bessel_n2): New function.
* trans-intrinsic.c (gfc_get_symbol_for_expr): Create
formal arg list.
(gfc_conv_intrinsic_function,gfc_is_intrinsic_libcall):
Add GFC_ISYM_JN2/GFC_ISYM_YN2 as case value.
* simplify.c (): For YN set to -INF if previous values
was -INF.
* trans-expr.c (gfc_conv_procedure_call): Don't crash
if sym->as is NULL.
* iresolve.c (gfc_resolve_extends_type_of): Set the
type of the dummy argument to the one of the actual.
2010-08-21 Tobias Burnus <burnus@net-b.de>
PR fortran/36158
PR fortran/33197
* m4/bessel.m4: Implement bessel_jn and bessel_yn.
* gfortran.map: Add the generated bessel_jn_r{4,8,10,16}
and bessel_yn_r{4,8,10,16}.
* Makefile.am: Add bessel.m4.
* Makefile.in: Regenerated.
* generated/bessel_r4.c: Generated.
* generated/bessel_r16.c: Generated.
* generated/bessel_r8.c: Generated.
* generated/bessel_r10.c: Generated.
2010-08-21 Tobias Burnus <burnus@net-b.de>
PR fortran/36158
PR fortran/33197
* gfortran.dg/bessel_6.f90: New.
* gfortran.dg/bessel_7.f90: New.
From-SVN: r163440
* lto-cgraph.c (lto_output_edge): Use gimple_has_body_p instead of flag_wpa.
* lto-streamer-out.c (lto_output): Likewise.
* passes.c (ipa_write_optimization_summaries): Initialize statement uids.
* lto.c (lto_1_to_1_map): Be prepared for node to have no file data.
(lto_wpa_write_files): Update comments.
From-SVN: r163438
* pex-common.c (pex_read_err): Set stderr_pipe to -1 if a
corresponding stream has been opened.
(pex_free): Close pipe file descriptors corresponding to child's
stdout and stderr before waiting.
From-SVN: r163426