mirror of git://gcc.gnu.org/git/gcc.git
predict.c (expr_expected_value_1): Assume compare-and-swap builtin boolean return is true.
* predict.c (expr_expected_value_1): Assume compare-and-swap builtin boolean return is true. From-SVN: r181862
This commit is contained in:
parent
ed079c4be7
commit
c08472eaf6
|
@ -1,3 +1,8 @@
|
||||||
|
2011-11-30 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* predict.c (expr_expected_value_1): Assume compare-and-swap builtin
|
||||||
|
boolean return is true.
|
||||||
|
|
||||||
2011-11-30 Jakub Jelinek <jakub@redhat.com>
|
2011-11-30 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR rtl-optimization/51044
|
PR rtl-optimization/51044
|
||||||
|
|
|
@ -1190,7 +1190,8 @@ static tree expr_expected_value (tree, bitmap);
|
||||||
/* Helper function for expr_expected_value. */
|
/* Helper function for expr_expected_value. */
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
expr_expected_value_1 (tree type, tree op0, enum tree_code code, tree op1, bitmap visited)
|
expr_expected_value_1 (tree type, tree op0, enum tree_code code,
|
||||||
|
tree op1, bitmap visited)
|
||||||
{
|
{
|
||||||
gimple def;
|
gimple def;
|
||||||
|
|
||||||
|
@ -1255,11 +1256,12 @@ expr_expected_value_1 (tree type, tree op0, enum tree_code code, tree op1, bitma
|
||||||
tree decl = gimple_call_fndecl (def);
|
tree decl = gimple_call_fndecl (def);
|
||||||
if (!decl)
|
if (!decl)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
|
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
|
||||||
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
|
switch (DECL_FUNCTION_CODE (decl))
|
||||||
|
{
|
||||||
|
case BUILT_IN_EXPECT:
|
||||||
{
|
{
|
||||||
tree val;
|
tree val;
|
||||||
|
|
||||||
if (gimple_call_num_args (def) != 2)
|
if (gimple_call_num_args (def) != 2)
|
||||||
return NULL;
|
return NULL;
|
||||||
val = gimple_call_arg (def, 0);
|
val = gimple_call_arg (def, 0);
|
||||||
|
@ -1267,6 +1269,24 @@ expr_expected_value_1 (tree type, tree op0, enum tree_code code, tree op1, bitma
|
||||||
return val;
|
return val;
|
||||||
return gimple_call_arg (def, 1);
|
return gimple_call_arg (def, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_N:
|
||||||
|
case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_1:
|
||||||
|
case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_2:
|
||||||
|
case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_4:
|
||||||
|
case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8:
|
||||||
|
case BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_16:
|
||||||
|
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE:
|
||||||
|
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N:
|
||||||
|
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1:
|
||||||
|
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_2:
|
||||||
|
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_4:
|
||||||
|
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_8:
|
||||||
|
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_16:
|
||||||
|
/* Assume that any given atomic operation has low contention,
|
||||||
|
and thus the compare-and-swap operation succeeds. */
|
||||||
|
return boolean_true_node;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue