https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65519

--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
The problematic statement is created by the gimple-match stuff:

Applying pattern match.pd:761, gimple-match.c:1727
Applying pattern match.pd:625, gimple-match.c:1525
gimple_simplified to _71 = I.3_30(ab) & 4294967295;
_45 = _71;

and falls through the cracks of replace_stmt_with_simplification:

  /* Play safe and do not allow abnormals to be mentioned in
     newly created statements.  See also maybe_push_res_to_seq.  */
  if ((TREE_CODE (ops[0]) == SSA_NAME
       && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[0]))
      || (ops[1]
      && TREE_CODE (ops[1]) == SSA_NAME
      && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[1]))
      || (ops[2]
      && TREE_CODE (ops[2]) == SSA_NAME
      && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2])))
    return false;

because ops[0] is already the new SSA_NAME (_71), which was created by:

tree
gimple_build (gimple_seq *seq, location_t loc,
          enum tree_code code, tree type, tree op0, tree op1,
          tree (*valueize)(tree))
{
  tree res = gimple_simplify (code, type, op0, op1, seq, valueize);
  if (!res)
    {
      if (gimple_in_ssa_p (cfun))
    res = make_ssa_name (type);
      else
    res = create_tmp_reg (type);
      gimple stmt = gimple_build_assign (res, code, op0, op1);
      gimple_set_location (stmt, loc);
      gimple_seq_add_stmt_without_update (seq, stmt);
    }
  return res;
}

I don't think that gimple_build can fail, so maybe the way out is to test
  stmt_references_abnormal_ssa_name (SSA_NAME_DEF_STMT (ops[x]))
instead of just
  SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops [x]))
in replace_stmt_with_simplification.

Reply via email to