re PR middle-end/71716 (gcc.dg/atomic/c11-atomic-exec-4.c is miscompiled with -march=corei7)
PR middle-end/71716 * gimple-fold.c (optimize_atomic_compare_exchange_p): Return false for SCALAR_FLOAT_TYPE_P type of expected var, or if TYPE_PRECISION is different from mode's bitsize. Small cleanup. From-SVN: r238239
This commit is contained in:
parent
712a93d637
commit
1de3c940d8
|
@ -1,3 +1,10 @@
|
|||
2016-07-12 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/71716
|
||||
* gimple-fold.c (optimize_atomic_compare_exchange_p): Return false
|
||||
for SCALAR_FLOAT_TYPE_P type of expected var, or if TYPE_PRECISION
|
||||
is different from mode's bitsize. Small cleanup.
|
||||
|
||||
2016-07-12 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR rtl-optimization/68961
|
||||
|
|
|
@ -2984,12 +2984,19 @@ optimize_atomic_compare_exchange_p (gimple *stmt)
|
|||
|
||||
tree expected = gimple_call_arg (stmt, 1);
|
||||
if (TREE_CODE (expected) != ADDR_EXPR
|
||||
|| !SSA_VAR_P (TREE_OPERAND (expected, 0))
|
||||
|| !is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (expected, 0)))
|
||||
|| !SSA_VAR_P (TREE_OPERAND (expected, 0)))
|
||||
return false;
|
||||
|
||||
tree etype = TREE_TYPE (TREE_OPERAND (expected, 0));
|
||||
if (!is_gimple_reg_type (etype)
|
||||
|| !auto_var_in_fn_p (TREE_OPERAND (expected, 0), current_function_decl)
|
||||
|| TREE_THIS_VOLATILE (TREE_TYPE (TREE_OPERAND (expected, 0)))
|
||||
|| TREE_CODE (TREE_TYPE (TREE_OPERAND (expected, 0))) == VECTOR_TYPE
|
||||
|| TREE_CODE (TREE_TYPE (TREE_OPERAND (expected, 0))) == COMPLEX_TYPE)
|
||||
|| TREE_THIS_VOLATILE (etype)
|
||||
|| VECTOR_TYPE_P (etype)
|
||||
|| TREE_CODE (etype) == COMPLEX_TYPE
|
||||
/* Don't optimize floating point expected vars, VIEW_CONVERT_EXPRs
|
||||
might not preserve all the bits. See PR71716. */
|
||||
|| SCALAR_FLOAT_TYPE_P (etype)
|
||||
|| TYPE_PRECISION (etype) != GET_MODE_BITSIZE (TYPE_MODE (etype)))
|
||||
return false;
|
||||
|
||||
tree weak = gimple_call_arg (stmt, 3);
|
||||
|
@ -3005,8 +3012,7 @@ optimize_atomic_compare_exchange_p (gimple *stmt)
|
|||
&& optab_handler (sync_compare_and_swap_optab, mode) == CODE_FOR_nothing)
|
||||
return false;
|
||||
|
||||
if (int_size_in_bytes (TREE_TYPE (TREE_OPERAND (expected, 0)))
|
||||
!= GET_MODE_SIZE (mode))
|
||||
if (int_size_in_bytes (etype) != GET_MODE_SIZE (mode))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue