enum tree_code code;
bool empty_or_with_defined_p = true;
+ /* Virtual operands don't need to be handled. */
+ if (virtual_operand_p (arg1))
+ return 0;
+
+ /* Special case A ? B : B as this will always simplify to B. */
+ if (operand_equal_for_phi_arg_p (arg0, arg1))
+ return 0;
+
+ gcond *cond = as_a <gcond *> (*gsi_last_bb (cond_bb));
+ code = gimple_cond_code (cond);
+
+ /* This transformation is only valid for equality comparisons. */
+ if (code != NE_EXPR && code != EQ_EXPR)
+ return 0;
+
/* If the type says honor signed zeros we cannot do this
optimization. */
if (HONOR_SIGNED_ZEROS (arg1))
empty_or_with_defined_p = false;
}
- gcond *cond = as_a <gcond *> (*gsi_last_bb (cond_bb));
- code = gimple_cond_code (cond);
-
- /* This transformation is only valid for equality comparisons. */
- if (code != NE_EXPR && code != EQ_EXPR)
- return 0;
-
/* We need to know which is the true edge and which is the false
edge so that we know if have abs or negative abs. */
extract_true_false_edges_from_block (cond_bb, &true_edge, &false_edge);