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] |
Comments added. I create another patch to add the parameter for AVG_LOOP_ITER. Both patches are attached. Thanks, Wei. On Wed, Jan 22, 2014 at 4:42 PM, Xinliang David Li <davidxl@google.com> wrote: > On Wed, Jan 22, 2014 at 2:23 PM, Wei Mi <wmi@google.com> wrote: >> This patch handles the mem access builtins in ivopt. The original >> problem described here: >> http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02648.html >> >> Bootstrapped and passed regression test. Performance test ok for >> plain, fdo and lipo. Ok for google 4.8 branch? >> >> Thanks, >> Wei. >> >> --- /usr/local/google/home/wmi/workarea/google_r205653_2/src/gcc/expr.c >> 2013-12-21 21:16:11.006695060 -0800 >> +++ gcc/expr.c 2013-12-09 11:16:22.698063077 -0800 >> @@ -7537,7 +7537,21 @@ >> tem = fold_build_pointer_plus (tem, TREE_OPERAND (exp, 1)); >> return expand_expr (tem, target, tmode, modifier); >> } >> + case TARGET_MEM_REF: >> + { > > Add more comments here to describe the new code. > >> + struct mem_address addr; >> + int old_cse_not_expected; >> + addr_space_t as >> + = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0)))); >> >> + get_address_description (exp, &addr); >> + result = addr_for_mem_ref (&addr, as, true); >> + old_cse_not_expected = cse_not_expected; >> + cse_not_expected = 1; >> + result = memory_address_addr_space (tmode, result, as); >> + cse_not_expected = old_cse_not_expected; >> + return result; >> + } >> case CONST_DECL: >> /* Expand the initializer like constants above. */ >> result = XEXP (expand_expr_constant (DECL_INITIAL (exp), >> @@ -9579,10 +9593,14 @@ >> struct mem_address addr; >> enum insn_code icode; >> unsigned int align; >> + int old_cse_not_expected; >> >> get_address_description (exp, &addr); >> op0 = addr_for_mem_ref (&addr, as, true); >> + old_cse_not_expected = cse_not_expected; > > Comments on the change. > >> + cse_not_expected = 1; >> op0 = memory_address_addr_space (mode, op0, as); >> + cse_not_expected = old_cse_not_expected; >> temp = gen_rtx_MEM (mode, op0); >> set_mem_attributes (temp, exp, 0); >> set_mem_addr_space (temp, as); >> --- /usr/local/google/home/wmi/workarea/google_r205653_2/src/gcc/target.def >> 2013-12-21 21:16:10.926694446 -0800 >> +++ gcc/target.def 2013-12-09 10:46:07.794472365 -0800 >> @@ -1119,6 +1119,14 @@ >> #undef HOOK_PREFIX >> #define HOOK_PREFIX "TARGET_" >> >> +DEFHOOK >> +(builtin_has_mem_ref_p, >> + "This hook return whether the @var{i}th param of the @var{builtin_function}\n\ >> +is a memory reference. If @var{i} is -1, return whether the >> @var{builtin_function}\n\ >> +contains any memory reference type param.", >> + bool, (int builtin_function, int i), >> + default_builtin_has_mem_ref_p) >> + >> /* Allow target specific overriding of option settings after options have >> been changed by an attribute or pragma or when it is reset at the >> end of the code affected by an attribute or pragma. */ >> --- /usr/local/google/home/wmi/workarea/google_r205653_2/src/gcc/gimple.c >> 2013-12-21 21:16:11.066695519 -0800 >> +++ gcc/gimple.c 2013-12-09 10:50:09.096289179 -0800 >> @@ -2574,7 +2574,8 @@ >> is_gimple_addressable (tree t) >> { >> return (is_gimple_id (t) || handled_component_p (t) >> - || TREE_CODE (t) == MEM_REF); >> + || TREE_CODE (t) == MEM_REF >> + || TREE_CODE (t) == TARGET_MEM_REF); >> } >> >> /* Return true if T is a valid gimple constant. */ >> @@ -2625,7 +2626,8 @@ >> op = TREE_OPERAND (op, 0); >> } >> >> - if (CONSTANT_CLASS_P (op) || TREE_CODE (op) == MEM_REF) >> + if (CONSTANT_CLASS_P (op) || TREE_CODE (op) == MEM_REF >> + || TREE_CODE (op) == TARGET_MEM_REF) >> return true; >> >> switch (TREE_CODE (op)) >> --- /usr/local/google/home/wmi/workarea/google_r205653_2/src/gcc/targhooks.c >> 2013-12-21 21:16:10.926694446 -0800 >> +++ gcc/targhooks.c 2013-12-09 10:45:50.154339207 -0800 >> @@ -543,6 +543,13 @@ >> } >> >> bool >> +default_builtin_has_mem_ref_p (int built_in_function ATTRIBUTE_UNUSED, >> + int i ATTRIBUTE_UNUSED) >> +{ >> + return false; >> +} >> + >> +bool >> hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false ( >> cumulative_args_t ca ATTRIBUTE_UNUSED, >> enum machine_mode mode ATTRIBUTE_UNUSED, >> --- /usr/local/google/home/wmi/workarea/google_r205653_2/src/gcc/tree-ssa-loop-ivopts.c >> 2014-01-22 11:57:10.420073494 -0800 >> +++ gcc/tree-ssa-loop-ivopts.c 2014-01-22 14:00:14.177908568 -0800 >> @@ -96,7 +96,7 @@ >> /* The infinite cost. */ >> #define INFTY 10000000 >> >> -#define AVG_LOOP_NITER(LOOP) 5 >> +#define AVG_LOOP_NITER(LOOP) 50 > > Need a parameter to control. This should also go in as an independent patch. > > > David >
Attachment:
patch1.txt
Description: Text document
Attachment:
patch2.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |