[Bug middle-end/67790] [6 Regression] verify_ssa failed: definition in block 20 follows the use

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 13 11:49:00 GMT 2015


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue here is that

  /* If we detected "res -= x[i]" earlier, rewrite it into
     "res += -x[i]" now.  If this turns out to be useless reassoc
     will clean it up again.  */
  if (orig_code == MINUS_EXPR)
    {
      tree rhs = gimple_assign_rhs2 (def_stmt);
      tree negrhs = make_ssa_name (TREE_TYPE (rhs));
      gimple *negate_stmt = gimple_build_assign (negrhs, NEGATE_EXPR, rhs);
      gimple_stmt_iterator gsi = gsi_for_stmt (def_stmt);
      set_vinfo_for_stmt (negate_stmt, new_stmt_vec_info (negate_stmt,
                                                          loop_info));
      gsi_insert_before (&gsi, negate_stmt, GSI_NEW_STMT);
      gimple_assign_set_rhs2 (def_stmt, negrhs);
      gimple_assign_set_rhs_code (def_stmt, PLUS_EXPR);
      update_stmt (def_stmt);
    }

actually inserts stmts into the IL which assigns UIDs to them (via
set_vinfo_for_stmt) which later confuses get_later/earlier_stmt.

The "proper" way of doing the above is by using a pattern which avoids
this issue.


More information about the Gcc-bugs mailing list