+2017-03-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/79981
+ * tree-vrp.c (extract_range_basic): Handle IMAGPART_EXPR of
+ ATOMIC_COMPARE_EXCHANGE ifn result.
+ (stmt_interesting_for_vrp, vrp_visit_stmt): Handle
+ IFN_ATOMIC_COMPARE_EXCHANGE.
+
2017-03-10 David Malcolm <dmalcolm@redhat.com>
PR driver/79875
}
/* Handle extraction of the two results (result of arithmetics and
a flag whether arithmetics overflowed) from {ADD,SUB,MUL}_OVERFLOW
- internal function. */
+ internal function. Similarly from ATOMIC_COMPARE_EXCHANGE. */
else if (is_gimple_assign (stmt)
&& (gimple_assign_rhs_code (stmt) == REALPART_EXPR
|| gimple_assign_rhs_code (stmt) == IMAGPART_EXPR)
case IFN_MUL_OVERFLOW:
subcode = MULT_EXPR;
break;
+ case IFN_ATOMIC_COMPARE_EXCHANGE:
+ if (code == IMAGPART_EXPR)
+ {
+ /* This is the boolean return value whether compare and
+ exchange changed anything or not. */
+ set_value_range (vr, VR_RANGE, build_int_cst (type, 0),
+ build_int_cst (type, 1), NULL);
+ return;
+ }
+ break;
default:
break;
}
case IFN_ADD_OVERFLOW:
case IFN_SUB_OVERFLOW:
case IFN_MUL_OVERFLOW:
+ case IFN_ATOMIC_COMPARE_EXCHANGE:
/* These internal calls return _Complex integer type,
but are interesting to VRP nevertheless. */
if (lhs && TREE_CODE (lhs) == SSA_NAME)
case IFN_ADD_OVERFLOW:
case IFN_SUB_OVERFLOW:
case IFN_MUL_OVERFLOW:
+ case IFN_ATOMIC_COMPARE_EXCHANGE:
/* These internal calls return _Complex integer type,
which VRP does not track, but the immediate uses
thereof might be interesting. */