This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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)
Attachment:
store_cpp_patch_19_3.txt
Description: Text document
Attachment:
store_ccp_test.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |