Commit 0247298c by Sebastian Pop Committed by Sebastian Pop

Don't use unshare_expr when not necessary.

2010-05-29  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/44306
	* gcc.dg/tree-ssa/pr44306.c: New.

	* tree-if-conv.c (is_true_predicate): New.
	(is_predicated): Use is_true_predicate.
	(add_to_predicate_list): Same.  Do not use unshare_expr.
	(add_to_dst_predicate_list): Same.

From-SVN: r160031
parent 32ccbfac
2010-05-29 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/44306
* tree-if-conv.c (is_true_predicate): New.
(is_predicated): Use is_true_predicate.
(add_to_predicate_list): Same. Do not use unshare_expr.
(add_to_dst_predicate_list): Same.
2010-05-29 Sebastian Pop <sebastian.pop@amd.com>
* tree-if-conv.c (add_to_dst_predicate_list): Do not use the ->aux
field on edges.
(predicate_bbs): Same.
......
2010-05-29 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/44306
* gcc.dg/tree-ssa/pr44306.c: New.
2010-05-29 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/ipa-cp-1.c: Update testcase.
......
/* { dg-do compile } */
/* { dg-options "-c -O3 -ftree-vectorize" { target *-*-* } } */
extern const int quant_coef8[6][8][8];
extern const int dequant_coef8[6][8][8];
int LevelScale8x8Luma_Intra[6][8][8];
int LevelScale8x8Luma_Inter[6][8][8];
int InvLevelScale8x8Luma_Intra[6][8][8];
int InvLevelScale8x8Luma_Inter[6][8][8];
short UseDefaultScalingMatrix8x8Flag[2];
void CalculateQuant8Param()
{
int i, j, k, temp;
int present[2];
for(k=0; j<8; j++)
for(i=0; i<8; i++)
{
temp = (i<<3)+j;
if((!present[0]) || UseDefaultScalingMatrix8x8Flag[0])
{
LevelScale8x8Luma_Intra[k][j][i] = (quant_coef8[k][j][i]<<4);
InvLevelScale8x8Luma_Intra[k][j][i] = dequant_coef8[k][j][i];
}
if((!present[1]) || UseDefaultScalingMatrix8x8Flag[1])
{
LevelScale8x8Luma_Inter[k][j][i] = (quant_coef8[k][j][i]<<4);
InvLevelScale8x8Luma_Inter[k][j][i] = dequant_coef8[k][j][i];
}
}
}
......@@ -130,44 +130,54 @@ ifc_temp_var (tree type, tree exp)
return stmt;
}
/* Return true when COND is a true predicate. */
static inline bool
is_true_predicate (tree cond)
{
return (cond == NULL_TREE
|| cond == boolean_true_node
|| integer_onep (cond));
}
/* Returns true when BB has a predicate that is not trivial: true or
NULL_TREE. */
static inline bool
is_predicated (basic_block bb)
{
return !is_true_predicate ((tree) bb->aux);
}
/* Add condition NEW_COND to the predicate list of basic block BB. */
static void
static inline void
add_to_predicate_list (basic_block bb, tree new_cond)
{
tree cond = (tree) bb->aux;
if (cond)
cond = fold_build2_loc (EXPR_LOCATION (cond),
TRUTH_OR_EXPR, boolean_type_node,
unshare_expr (cond), new_cond);
else
cond = new_cond;
bb->aux = cond;
bb->aux = is_true_predicate (cond) ? new_cond :
fold_build2_loc (EXPR_LOCATION (cond),
TRUTH_OR_EXPR, boolean_type_node,
cond, new_cond);
}
/* Add the condition COND to the previous condition PREV_COND, and add
this to the predicate list of the destination of edge E. LOOP is
the loop to be if-converted. */
static tree
static void
add_to_dst_predicate_list (struct loop *loop, edge e,
tree prev_cond, tree cond)
{
tree new_cond = NULL_TREE;
if (!flow_bb_inside_loop_p (loop, e->dest))
return NULL_TREE;
return;
if (prev_cond == boolean_true_node || !prev_cond)
new_cond = unshare_expr (cond);
else
new_cond = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
unshare_expr (prev_cond), cond);
if (!is_true_predicate (prev_cond))
cond = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
prev_cond, cond);
add_to_predicate_list (e->dest, new_cond);
return new_cond;
add_to_predicate_list (e->dest, cond);
}
/* Return true if one of the successor edges of BB exits LOOP. */
......@@ -568,19 +578,6 @@ predicate_bbs (loop_p loop)
return true;
}
/* Returns true when BB has a predicate that is not trivial: true or
NULL_TREE. */
static bool
is_predicated (basic_block bb)
{
tree cond = (tree) bb->aux;
return (cond != NULL_TREE
&& cond != boolean_true_node
&& !integer_onep (cond));
}
/* Return true when LOOP is if-convertible.
LOOP is if-convertible if:
- it is innermost,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment