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/79622] [6/7/8 Regression] Wrong code w/ -O2 -floop-nest-optimize


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spop at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
we fail to represent the PHI defining g5_23:

  <bb 4> [83.33%] [count: INV]:
  # l9_22 = PHI <0(3), l9_16(5)>
  # g5_23 = PHI <-1(3), 0(5)>
  # ivtmp_20 = PHI <5(3), ivtmp_13(5)>
  dc[l9_22] = g5_23;
  l9_16 = l9_22 + 1;
  ivtmp_13 = ivtmp_20 - 1;
  if (ivtmp_13 != 0)
    goto <bb 5>; [80.00%] [count: INV]
  else
    goto <bb 6>; [20.00%] [count: INV]

  <bb 5> [66.66%] [count: INV]:
  goto <bb 4>; [100.00%] [count: INV]

[scheduler] original ast:
for (int c0 = 0; c0 <= 1; c0 += 1)
  for (int c1 = 0; c1 <= 4; c1 += 1)
    S_4(c0, c1);

not sure if this is a case of "cross-BB-scalar-vars" but that doesn't handle
non-SSA uses.  So a similar case would be the following:

 # _1 = PHI <_2(entry), 0(latch)>

The following patch fixes this by always marking non-SCEV analyzable
PHI defs as "writes".

Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c       (revision 252062)
+++ gcc/graphite-scop-detection.c       (working copy)
@@ -1744,7 +1744,9 @@ build_cross_bb_scalars_def (scop_p scop,
   gimple *use_stmt;
   imm_use_iterator imm_iter;
   FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
-    if (def_bb != gimple_bb (use_stmt) && !is_gimple_debug (use_stmt))
+    if ((def_bb != gimple_bb (use_stmt) && !is_gimple_debug (use_stmt))
+       /* ???  PR79622.  */
+       || gimple_code (SSA_NAME_DEF_STMT (def)) == GIMPLE_PHI)
       {
        writes->safe_push (def);
        DEBUG_PRINT (dp << "Adding scalar write: ";

passes the graphite.exp testsuites, otherwise untested.

Sebastian?

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