OSDN Git Service

Do not check whether memory references accessed in every iteration trap.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Aug 2010 23:35:56 +0000 (23:35 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Aug 2010 23:35:56 +0000 (23:35 +0000)
commite1cc68bd3e4621c0829b59365aeb11fc4c132e5f
tree82b29bdf050426fdf9c44df1c3fd18a14cf5b09d
parent3b91ccd9c4954f50976d2305ab58f1b8de1cb600
Do not check whether memory references accessed in every iteration trap.

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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163531 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/gimple.c
gcc/gimple.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ifc-5.c [new file with mode: 0644]
gcc/tree-data-ref.h
gcc/tree-if-conv.c