[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-05-02 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|7.0 |7.2

--- Comment #5 from Jakub Jelinek  ---
GCC 7.1 has been released.

[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-06-03 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #6 from David Binderman  ---
I see this ice now, but in code that isn't anything to do with isl.

Be nice to be able to put this one to bed, because nothing has
happened on it for three months.

[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-06-03 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

--- Comment #7 from David Binderman  ---
Problem seems to be between gcc revision 248553 and 248835.
I'll have a go at reducing the demonstrator code.

[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-06-03 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

--- Comment #8 from David Binderman  ---
Reduced code:

a;
b() {
  int c, d;
  if (a)
d = b();
  return 1 + c + d;
}

Flag -O2 required.

[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-06-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

Richard Biener  changed:

   What|Removed |Added

 CC||sebpop at gmail dot com

--- Comment #9 from Richard Biener  ---
Ok, so what is missing seems to be notifying ISL of the scalar write in

  pretmp_38 = e[f_20][2];

as we convert the loop-around reg

prephitmp_39 = PHI 

to memory.

Converting dr: pdr_4 (read
in gimple stmt: prephitmp_39 = PHI 
data accesses: { S_7[i1] -> [138] }
subscript sizes: { S_7[i1] -> [138] : i1 >= 0 }
)
To polyhedral representation:
  - access functions: { S_7[i1] -> [138] }
  - subscripts: { S_7[i1] -> [138] : i1 >= 0 }
...
Converting dr: pdr_11 (write
in gimple stmt: pretmp_38 = e[f_20][2];
data accesses: { S_6[i1] -> [138] }
subscript sizes: { S_6[i1] -> [138] : i1 >= 0 }
)
To polyhedral representation:
  - access functions: { S_6[i1] -> [138] }
  - subscripts: { S_6[i1] -> [138] : i1 >= 0 }

not sure what has to match up here but I see S_6 vs. S_7 and [138].

Then:

[sese-to-poly] original schedule:
domain: "{ S_5[i1] : 0 <= i1 <= 1; S_6[i1 = 0]; S_8[]; S_7[i1] : 0 <= i1 <= 1;
S_4[i1, i2] : 0 <= i1 <= 1 and 0 <= i2 <= 5 }"
child:
  sequence:
  - filter: "{ S_4[i1, i2]; S_5[i1]; S_7[i1] }"
child:
  schedule: "L_1[{ S_4[i1, i2] -> [(i1)]; S_5[i1] -> [(i1)]; S_7[i1] ->
[(i1)] }]"
  child:
sequence:
- filter: "{ S_7[i1] }"
- filter: "{ S_4[i1, i2] }"
  child:
schedule: "L_2[{ S_4[i1, i2] -> [(i2)] }]"
- filter: "{ S_5[i1] }"
  - filter: "{ S_8[] }"
  - filter: "{ S_6[i1] }"
child:
  schedule: "L_1[{ S_6[i1] -> [(i1)] }]"

which I can't really decipher.

[scheduler] original ast:
{
  for (int c0 = 0; c0 <= 1; c0 += 1) {
S_7(c0);
for (int c1 = 0; c1 <= 5; c1 += 1)
  S_4(c0, c1);
S_5(c0);
  }
  S_8();
  S_6(0);
}

has S_6 in bogus position AFAICS.  It should be inside the outer loop.

Sebastian - any hint where things go wrong?  Code-gen inserts S_6 outside
of the loop (as expected from the above AST) leading to wrong-code or
SSA verification failure.

Testcase in comment#4 on the GCC 7 branch, ISL 0.18.

We do build_schedule_loop_nest twice for the outer loop and the intermediate
pbb seems to confuse add_in_sequence or embed_in_surrounding_loops.

In particular the pbb for the loop-closed PHI block of the outer loop is
before the latch block of the outer loop in the pbbs array.  Not sure if
that matters...

So it might be that the change using RPO order to sort the dominator children
instead of postorder on the inverted CFG triggered this as regression.

In any case relying on this order seems fishy so either we need to sort pbbs
or rewrite schedule generation to not rely on such order?

[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-06-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

--- Comment #10 from Richard Biener  ---
Indeed

Index: gcc/domwalk.c
===
--- gcc/domwalk.c   (revision 248914)
+++ gcc/domwalk.c   (working copy)
@@ -243,7 +243,7 @@ dom_walker::walk (basic_block bb)
   if (m_dom_direction == CDI_DOMINATORS)
 {
   postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
-  postorder_num = pre_and_rev_post_order_compute (NULL, postorder, true);
+  postorder_num = inverted_post_order_compute (postorder);
   bb_postorder = XNEWVEC (int, last_basic_block_for_fn (cfun));
   for (int i = 0; i < postorder_num; ++i)
bb_postorder[postorder[i]] = i;

"fixes" it.  But by luck I suspect.

[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-06-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #11 from Richard Biener  ---
Created attachment 41479
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41479&action=edit
patch

Patch I am testing.

[Bug tree-optimization/79483] [7/8 Regression] [graphite] ICE: verify_ssa failed (error: definition in block 31 does not dominate use in block 28)

2017-06-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79483

--- Comment #12 from Richard Biener  ---
Author: rguenth
Date: Fri Jun  9 09:36:06 2017
New Revision: 249052

URL: https://gcc.gnu.org/viewcvs?rev=249052&root=gcc&view=rev
Log:
2017-06-09  Richard Biener  

PR tree-optimization/79483
* graphite-scop-detection.c (order): New global.
(get_order): Compute bb to order mapping that satisfies code
generation constraints.
(cmp_pbbs): New helper.
(build_scops): Start domwalk at entry block, sort generated
pbbs.

* gcc.dg/graphite/pr79483.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/graphite/pr79483.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/graphite-scop-detection.c
trunk/gcc/testsuite/ChangeLog