parent
afa55b38c8
commit
e29cc9b402
12
ChangeLog
12
ChangeLog
|
@ -1,13 +1,11 @@
|
||||||
|
|
||||||
|
2008-05-18 Xinliang David Li <davidxl@google.com>
|
||||||
|
|
||||||
|
* ChangeLog: Remove wrong ChangeLog entry.
|
||||||
|
|
||||||
2008-05-17 Xinliang David Li <davidxl@google.com>
|
2008-05-17 Xinliang David Li <davidxl@google.com>
|
||||||
|
|
||||||
* gcc/tree-ssa-dce.c : conditional dead call elimination
|
* MAINTAINERS (Write After Approval): Add myself.
|
||||||
* gcc/opts.c : enable the optimization at >=O2
|
|
||||||
* gcc/common.opt : new flag for control the optimization
|
|
||||||
* gcc/doc/invoke.texi : documentation change
|
|
||||||
* gcc/testsuite/gcc.dg/cdce1.c : new test case
|
|
||||||
* gcc/testsuite/gcc.dg/cdce2.c : new test case
|
|
||||||
*MAINTAINERS : Add myself (write after approval)
|
|
||||||
|
|
||||||
2008-05-15 Janus Weil <janus@gcc.gnu.org>
|
2008-05-15 Janus Weil <janus@gcc.gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
2008-05-18 Xinliang David Li <davidxl@google.com>
|
||||||
|
|
||||||
|
* gcc/tree-ssa-dce.c: Coding style fix.
|
||||||
|
(check_pow): Documentation comment.
|
||||||
|
(check_log): Documenation comment. Coding style fix.
|
||||||
|
(is_unnecessary_except_errno_call): Ditto.
|
||||||
|
(gen_conditions_for_pow): Ditto.
|
||||||
|
(gen_conditions_for_log): Ditto.
|
||||||
|
(gen_shrink_wrap_conditions): Ditto.
|
||||||
|
(shrink_wrap_one_built_in_calls): Ditto.
|
||||||
|
* gcc/doc/invoke.texi: Better documentation string.
|
||||||
|
* ChangeLog: Fix wrong change log entries from
|
||||||
|
May 17 checkin on function call DCE.
|
||||||
|
|
||||||
2008-05-17 Kaz Kojima <kkojima@gcc.gnu.org>
|
2008-05-17 Kaz Kojima <kkojima@gcc.gnu.org>
|
||||||
|
|
||||||
* config/sh/sh.c (sh_output_mi_thunk): Update the use of
|
* config/sh/sh.c (sh_output_mi_thunk): Update the use of
|
||||||
|
@ -12,6 +26,25 @@
|
||||||
* fold-const.c (fold_unary) <CASE_CONVERT>: Fold the cast into
|
* fold-const.c (fold_unary) <CASE_CONVERT>: Fold the cast into
|
||||||
a BIT_AND_EXPR only for an INTEGER_TYPE.
|
a BIT_AND_EXPR only for an INTEGER_TYPE.
|
||||||
|
|
||||||
|
2008-05-17 Xinliang David Li <davidxl@google.com>
|
||||||
|
|
||||||
|
* gcc/tree-ssa-dce.c (cond_dead_built_in_calls): New static variable.
|
||||||
|
(check_pow, check_log, is_unnecessary_except_errno_call): New
|
||||||
|
functions to check for eliminating math functions that are pure
|
||||||
|
except for setting errno.
|
||||||
|
(gen_conditions_for_pow, gen_conditionas_for_log): New functions to
|
||||||
|
general condition expressions for shrink-wrapping pow/log calls.
|
||||||
|
(gen_shrink_wrap_conditions): Ditto.
|
||||||
|
(shrink_wrap_one_built_in_call): Ditto.
|
||||||
|
(shrink_wrap_conditional_dead_built_in_calls): Ditto.
|
||||||
|
(mark_operand_necessary): If debugging, output if OP is necessary.
|
||||||
|
(eliminate_unnecessary_stmts): Eliminate pow, log calls that are
|
||||||
|
unnecessary.
|
||||||
|
* gcc/opts.c (decode_options): set flag_tree_builtin_dce to 1 when
|
||||||
|
opt level >= 2.
|
||||||
|
* gcc/common.opt: New user flag -ftree-builtin-dce.
|
||||||
|
* gcc/doc/invoke.texi (-ftree-builtin-dce): New option.
|
||||||
|
|
||||||
2008-05-16 David S. Miller <davem@davemloft.net>
|
2008-05-16 David S. Miller <davem@davemloft.net>
|
||||||
|
|
||||||
* config/sparc/linux.h (NO_PROFILE_COUNTERS): Undef before
|
* config/sparc/linux.h (NO_PROFILE_COUNTERS): Undef before
|
||||||
|
|
|
@ -5876,9 +5876,9 @@ default at @option{-O} and higher.
|
||||||
|
|
||||||
@item -ftree-builtin-dce
|
@item -ftree-builtin-dce
|
||||||
@opindex ftree-builtin-dce
|
@opindex ftree-builtin-dce
|
||||||
Perform conditional dead code elimination (DCE) on builtin calls that
|
Perform conditional dead code elimination (DCE) for calls to builtin functions
|
||||||
may set errno but are otherwise side-effect free. This flag is enabled by
|
that may set errno but are otherwise side-effect free. This flag is enabled by
|
||||||
default at @option{-O} and higher.
|
default at @option{-O2} and higher.
|
||||||
|
|
||||||
@item -ftree-dominator-opts
|
@item -ftree-dominator-opts
|
||||||
@opindex ftree-dominator-opts
|
@opindex ftree-dominator-opts
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2008-05-17 Xinliang David Li <davidxl@google.com>
|
||||||
|
|
||||||
|
* gcc.dg/cdce1.c: New test
|
||||||
|
* gcc.dg/cdce2.c: New test
|
||||||
|
|
||||||
2008-05-17 Tobias Burnus <burnus@net-b.de>
|
2008-05-17 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
* gfortran.dg/initialization_19.f90: New test.
|
* gfortran.dg/initialization_19.f90: New test.
|
||||||
|
|
|
@ -217,7 +217,7 @@ find_all_control_dependences (struct edge_list *el)
|
||||||
if (error_cond(args))
|
if (error_cond(args))
|
||||||
built_in_call(args)
|
built_in_call(args)
|
||||||
|
|
||||||
( An actual simple exampl is :
|
An actual simple exampl is :
|
||||||
log (x); // Mostly dead call
|
log (x); // Mostly dead call
|
||||||
==>
|
==>
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
@ -226,7 +226,7 @@ find_all_control_dependences (struct edge_list *el)
|
||||||
in majority of the cases, log won't be called with x out of
|
in majority of the cases, log won't be called with x out of
|
||||||
range. The branch is totally predicatible, so the branch cost
|
range. The branch is totally predicatible, so the branch cost
|
||||||
is low. Such optimization improves the performance of
|
is low. Such optimization improves the performance of
|
||||||
an important application in a big search company by 20% )
|
an important application in a big search company.
|
||||||
|
|
||||||
Note that library functions are not supposed to clear errno to zero without
|
Note that library functions are not supposed to clear errno to zero without
|
||||||
error.
|
error.
|
||||||
|
@ -245,6 +245,10 @@ find_all_control_dependences (struct edge_list *el)
|
||||||
inlining). */
|
inlining). */
|
||||||
|
|
||||||
|
|
||||||
|
/* A helper method to help select calls to pow that are suitable for
|
||||||
|
conditional DCE transformation. Returns true if the pow call is
|
||||||
|
a candidate.*/
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
check_pow (tree pow_call)
|
check_pow (tree pow_call)
|
||||||
{
|
{
|
||||||
|
@ -325,6 +329,10 @@ check_pow (tree pow_call)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A helper function to help select candidate calls to log that are
|
||||||
|
suitable for conditional DCE. Returns true if the log call is a
|
||||||
|
candidate. */
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
check_log (tree log_call)
|
check_log (tree log_call)
|
||||||
{
|
{
|
||||||
|
@ -340,8 +348,9 @@ check_log (tree log_call)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* A helper function to determine if a builtin function
|
/* A helper function to determine if a builtin function call is a
|
||||||
call is a candidate for conditional DCE. */
|
candidate for conditional DCE. Returns true if the builtin call
|
||||||
|
is a candidate. */
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_unnecessary_except_errno_call (tree call)
|
is_unnecessary_except_errno_call (tree call)
|
||||||
|
@ -353,9 +362,7 @@ is_unnecessary_except_errno_call (tree call)
|
||||||
if (!flag_tree_builtin_dce)
|
if (!flag_tree_builtin_dce)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gcc_assert (call);
|
gcc_assert (call && TREE_CODE (call) == CALL_EXPR);
|
||||||
gcc_assert (!DECL_P (call));
|
|
||||||
gcc_assert (TREE_CODE (call) == CALL_EXPR);
|
|
||||||
|
|
||||||
fn = get_callee_fndecl (call);
|
fn = get_callee_fndecl (call);
|
||||||
if (!fn || !DECL_BUILT_IN (fn))
|
if (!fn || !DECL_BUILT_IN (fn))
|
||||||
|
@ -378,9 +385,6 @@ is_unnecessary_except_errno_call (tree call)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_unnecessary_except_errno)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return is_unnecessary_except_errno;
|
return is_unnecessary_except_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,7 +724,8 @@ propagate_necessity (struct edge_list *el)
|
||||||
/* Method to generate conditional statements for guarding condionally
|
/* Method to generate conditional statements for guarding condionally
|
||||||
dead calls to pow. One or more statements can be generated for
|
dead calls to pow. One or more statements can be generated for
|
||||||
each logical condition. Statement groups of different conditions
|
each logical condition. Statement groups of different conditions
|
||||||
are separated by a NULL tree. */
|
are separated by a NULL tree and they are stored in the VEC
|
||||||
|
conds. The number of logical conditions are stored in *nconds. */
|
||||||
static void
|
static void
|
||||||
gen_conditions_for_pow (tree pow_call, enum built_in_function fnc,
|
gen_conditions_for_pow (tree pow_call, enum built_in_function fnc,
|
||||||
VEC (tree, heap)* conds, unsigned * nconds)
|
VEC (tree, heap)* conds, unsigned * nconds)
|
||||||
|
@ -872,7 +877,7 @@ gen_conditions_for_pow (tree pow_call, enum built_in_function fnc,
|
||||||
VEC_safe_push (tree, heap, conds, stmt3);
|
VEC_safe_push (tree, heap, conds, stmt3);
|
||||||
(*nconds)++;
|
(*nconds)++;
|
||||||
|
|
||||||
/* now a seperator*/
|
/* Now a seperator*/
|
||||||
VEC_safe_push (tree, heap, conds, NULL);
|
VEC_safe_push (tree, heap, conds, NULL);
|
||||||
|
|
||||||
temp1 = create_tmp_var (int_typ, "DCE_COND1");
|
temp1 = create_tmp_var (int_typ, "DCE_COND1");
|
||||||
|
@ -956,8 +961,8 @@ gen_shrink_wrap_conditions (tree bi_call, VEC (tree, heap)* conds, unsigned int
|
||||||
enum built_in_function fnc;
|
enum built_in_function fnc;
|
||||||
gcc_assert (nconds && conds);
|
gcc_assert (nconds && conds);
|
||||||
gcc_assert (VEC_length(tree, conds) == 0);
|
gcc_assert (VEC_length(tree, conds) == 0);
|
||||||
gcc_assert (TREE_CODE (bi_call) == GIMPLE_MODIFY_STMT ||
|
gcc_assert (TREE_CODE (bi_call) == GIMPLE_MODIFY_STMT
|
||||||
TREE_CODE (bi_call) == CALL_EXPR);
|
|| TREE_CODE (bi_call) == CALL_EXPR);
|
||||||
|
|
||||||
call = bi_call;
|
call = bi_call;
|
||||||
if (TREE_CODE (call) == GIMPLE_MODIFY_STMT)
|
if (TREE_CODE (call) == GIMPLE_MODIFY_STMT)
|
||||||
|
@ -970,18 +975,16 @@ gen_shrink_wrap_conditions (tree bi_call, VEC (tree, heap)* conds, unsigned int
|
||||||
|
|
||||||
switch (fnc)
|
switch (fnc)
|
||||||
{
|
{
|
||||||
/*CASE_FLT_FN(BUILT_IN_POW)*/
|
|
||||||
case BUILT_IN_POW:
|
case BUILT_IN_POW:
|
||||||
gen_conditions_for_pow (call, fnc, conds, nconds);
|
gen_conditions_for_pow (call, fnc, conds, nconds);
|
||||||
break;
|
break;
|
||||||
/*CASE_FLT_FN(BUILT_IN_LOG):*/
|
|
||||||
case BUILT_IN_LOG:
|
case BUILT_IN_LOG:
|
||||||
case BUILT_IN_LOGF:
|
case BUILT_IN_LOGF:
|
||||||
case BUILT_IN_LOGL:
|
case BUILT_IN_LOGL:
|
||||||
gen_conditions_for_log (call, fnc, conds, nconds);
|
gen_conditions_for_log (call, fnc, conds, nconds);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
gcc_assert (0);
|
gcc_unreachable();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -990,6 +993,7 @@ gen_shrink_wrap_conditions (tree bi_call, VEC (tree, heap)* conds, unsigned int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Propability of the branch (to the call) is taken. */
|
||||||
#define ERR_PROB 0.01
|
#define ERR_PROB 0.01
|
||||||
|
|
||||||
/* The method to shrink wrap a partially dead builtin call
|
/* The method to shrink wrap a partially dead builtin call
|
||||||
|
@ -1044,7 +1048,8 @@ shrink_wrap_one_built_in_call (tree bi_call)
|
||||||
{
|
{
|
||||||
tree c = VEC_index (tree, conds, ci);
|
tree c = VEC_index (tree, conds, ci);
|
||||||
gcc_assert ( c || ci != 0 );
|
gcc_assert ( c || ci != 0 );
|
||||||
if (!c) break;
|
if (!c)
|
||||||
|
break;
|
||||||
bsi_insert_before (&bi_call_bsi, c, BSI_SAME_STMT);
|
bsi_insert_before (&bi_call_bsi, c, BSI_SAME_STMT);
|
||||||
cond_expr = c;
|
cond_expr = c;
|
||||||
}
|
}
|
||||||
|
@ -1052,7 +1057,7 @@ shrink_wrap_one_built_in_call (tree bi_call)
|
||||||
ci ++;
|
ci ++;
|
||||||
gcc_assert (cond_expr && TREE_CODE (cond_expr) == COND_EXPR);
|
gcc_assert (cond_expr && TREE_CODE (cond_expr) == COND_EXPR);
|
||||||
|
|
||||||
/* now the label*/
|
/* Now the label*/
|
||||||
bi_call_label_decl = create_artificial_label ();
|
bi_call_label_decl = create_artificial_label ();
|
||||||
bi_call_label = build1 (LABEL_EXPR, void_type_node, bi_call_label_decl);
|
bi_call_label = build1 (LABEL_EXPR, void_type_node, bi_call_label_decl);
|
||||||
bsi_insert_before (&bi_call_bsi, bi_call_label, BSI_SAME_STMT);
|
bsi_insert_before (&bi_call_bsi, bi_call_label, BSI_SAME_STMT);
|
||||||
|
@ -1068,7 +1073,7 @@ shrink_wrap_one_built_in_call (tree bi_call)
|
||||||
join_tgt_in_edge_fall_thru->probability =
|
join_tgt_in_edge_fall_thru->probability =
|
||||||
REG_BR_PROB_BASE - bi_call_in_edge0->probability;
|
REG_BR_PROB_BASE - bi_call_in_edge0->probability;
|
||||||
|
|
||||||
/* code generation for the rest of the conditions */
|
/* Code generation for the rest of the conditions */
|
||||||
guard_bb = guard_bb0;
|
guard_bb = guard_bb0;
|
||||||
for (; nconds > 0; )
|
for (; nconds > 0; )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue