[autovect] [patch] Extend store cpp

Revital1 Eres ERES@il.ibm.com
Mon Mar 19 16:26:00 GMT 2007


Hello,

This patch enhance store ccp to propagate constants from stores to
loads when the previous implementation failed due to alias uncertainty.
The testcase attached demonstrates this optimization:

S[5].x = 0;
S[5].y = 0;

x = S[5].x;
y = S[5].y;

Previously x = S[5].x; failed to be replaced with x = 0.  This patch
fixes this problem by allowing the propagation of constants if all the
stores in the alias group are initialized with the same constant.

I used the get_stmt_rhs_def_stmt function Richard Guenther
introduced in his patch to walk the virtual def-use chains
with adjustments to make it suitable for this optimization.
(http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00669.html)

Bootstrap and tested on ppc. OK for autovect branch?

Revital

2007-03-19  Revital Eres  <eres@il.ibm.com>

        * tree-ssa-propagate.c (all_vdef_have_same_lattice_const_value):
          New function to get the defining stmt.
          (get_def_of_stmt_rhs): New helper function
          which walks on the virtual use-def chain to get the
          defining stmt.
          (replace_vuses_in): Call it.
          (do_store_ccp): New function.
        * tree-ssa-ccp.c (visit_assignment): Call it.
        * tree-ssa-propagate.h (all_vdef_have_same_lattice_const_value):
          Declare.
        * testsuite/gcc.dg/store_ccp_test.c: New test.


(See attached file: store_cpp_patch_19_3.txt)(See attached file:
store_ccp_test.txt)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: store_cpp_patch_19_3.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070319/03d3d8a9/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: store_ccp_test.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070319/03d3d8a9/attachment-0001.txt>


More information about the Gcc-patches mailing list