This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/70956] ICE in build_cross_bb_scalars_def, at graphite-scop-detection.c:1725


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

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

--- Comment #1 from vries at gcc dot gnu.org ---
Consider graphite_find_cross_bb_scalar_vars:
...
static void
graphite_find_cross_bb_scalar_vars (scop_p scop, gimple *stmt,
                                    vec<scalar_use> *reads, vec<tree> *writes)
{
  tree def;

  if (gimple_code (stmt) == GIMPLE_ASSIGN)
    def = gimple_assign_lhs (stmt);
  else if (gimple_code (stmt) == GIMPLE_CALL)
    def = gimple_call_lhs (stmt);
  else if (gimple_code (stmt) == GIMPLE_PHI)
    def = gimple_phi_result (stmt);
  else
    return;


  build_cross_bb_scalars_def (scop, def, gimple_bb (stmt), writes);
  ...
...

We arrive at graphite_find_cross_bb_scalar_vars with:
...
(gdb) call debug_gimple_stmt (stmt)
# VUSE <.MEM_10(D)>
f2 (_1);
...

The call is resultless, so def becomes NULL_TREE.

This tentative patch handles NULL_TREE def in build_cross_bb_scalars_def, and
fixes the assert:
...
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 7615842..dd50a1e 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1722,8 +1722,7 @@ static void
 build_cross_bb_scalars_def (scop_p scop, tree def, basic_block def_bb,
                             vec<tree> *writes)
 {
-  gcc_assert (def);
-  if (!is_gimple_reg (def))
+  if (!def || !is_gimple_reg (def))
     return;

   /* Do not gather scalar variables that can be analyzed by SCEV as they can
be
...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]