[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-10 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

Tamar Christina  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #17 from Tamar Christina  ---
Fixed, thanks for the reports!

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #16 from GCC Commits  ---
The master branch has been updated by Tamar Christina :

https://gcc.gnu.org/g:9e7c77c7933b1bb0dd07214333e52a9a896fa349

commit r14-7101-g9e7c77c7933b1bb0dd07214333e52a9a896fa349
Author: Tamar Christina 
Date:   Wed Jan 10 12:51:54 2024 +

middle-end: Fix dominators updates when peeling with multiple exits
[PR113144]

When we peel at_exit we are moving the new loop at the exit of the previous
loop.  This means that the blocks outside the loop dat the previous loop
used to
dominate are no longer being dominated by it.

The new dominators however are hard to predict since if the loop has
multiple
exits and all the exits are an "early" one then we always execute the
scalar
loop.  In this case the scalar loop can completely dominate the new loop.

If we later have skip_vector then there's an additional skip edge added
that
might change the dominators.

The previous patch would force an update of all blocks reachable from the
new
exits.  This one updates *only* blocks that we know the scalar exits
dominated.

For the examples this reduces the blocks to update from 18 to 3.

gcc/ChangeLog:

PR tree-optimization/113144
PR tree-optimization/113145
* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
Update all BB that the original exits dominated.

gcc/testsuite/ChangeLog:

PR tree-optimization/113144
PR tree-optimization/113145
* gcc.dg/vect/vect-early-break_94-pr113144.c: New test.

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-09 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #15 from Tamar Christina  ---
(In reply to Martin Jambor from comment #13)
> The testcase below segfaults when compiled with master configured with
> release checking.  However, it is very likely affected by this bug (it
> fails with checking compiler like testcases for this issue do) and so
> I did not want to file a new bug for a testcase where we know we're
> currently having problems keeping dominance information.
> 
> Tamar, after you fix this issue, can you please check if the following
> segfaults when compiled with -std=gnu99 -fpermissive -fgnu89-inline
> -Ofast -march=znver2 -fprofile-generate -S ?
> 

yeah, with my current patches it works fine:

> ./install/bin/gcc segf.c -std=gnu99 -fpermissive -fgnu89-inline -Ofast 
> -march=znver2 -fprofile-generate -S -w; and echo $status
0

I'll commit the bulk tomorrow. Thanks for the testcase!

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-09 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #14 from Tamar Christina  ---
Yeah I'll test. Richi approved the fix today and I'll commit after a final
regtest

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-09 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #13 from Martin Jambor  ---
The testcase below segfaults when compiled with master configured with
release checking.  However, it is very likely affected by this bug (it
fails with checking compiler like testcases for this issue do) and so
I did not want to file a new bug for a testcase where we know we're
currently having problems keeping dominance information.

Tamar, after you fix this issue, can you please check if the following
segfaults when compiled with -std=gnu99 -fpermissive -fgnu89-inline
-Ofast -march=znver2 -fprofile-generate -S ?

Thanks!

replace_reg_with_saved_mem_i, replace_reg_with_saved_mem_nregs,
replace_reg_with_saved_mem_mem_1;
replace_reg_with_saved_mem_mode() {
  if (replace_reg_with_saved_mem_i)
return;
  while (++replace_reg_with_saved_mem_i < replace_reg_with_saved_mem_nregs)
if (replace_reg_with_saved_mem_i)
  break;
  if (replace_reg_with_saved_mem_i)
if (replace_reg_with_saved_mem_mem_1)
  adjust_address_1();
  replace_reg_with_saved_mem_mem_1 ? fancy_abort() : 0;
}

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-08 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #12 from Tamar Christina  ---
(In reply to Andrew Pinski from comment #11)
> (In reply to Zdenek Sojka from comment #10)
> > Created attachment 57009 [details]
> > simpler testcase using _BitInt()
> > 
> > $ x86_64-pc-linux-gnu-gcc -O3 -mavx2 testcase.c 
> > testcase.c: In function 'foo':
> > testcase.c:5:1: error: dominator of 24 should be 57, not 12
> > 5 | foo (void)
> >   | ^~~
> > testcase.c:5:1: error: dominator of 25 should be 57, not 12
> > during GIMPLE pass: vect
> > testcase.c:5:1: internal compiler error: in verify_dominators, at
> > dominance.cc:1194
> > 0x742528 verify_dominators(cdi_direction)
> > ...
> 
> that might be a different issue ...

It's the same issue, but also fixed by the patch.
It's however not simpler :) this expands into a series of loops, and one of the
loops has 3 exits which is why it triggers.

The fixes that I am re-spinning fixes this and correctly vectorizes the loops.

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #11 from Andrew Pinski  ---
(In reply to Zdenek Sojka from comment #10)
> Created attachment 57009 [details]
> simpler testcase using _BitInt()
> 
> $ x86_64-pc-linux-gnu-gcc -O3 -mavx2 testcase.c 
> testcase.c: In function 'foo':
> testcase.c:5:1: error: dominator of 24 should be 57, not 12
> 5 | foo (void)
>   | ^~~
> testcase.c:5:1: error: dominator of 25 should be 57, not 12
> during GIMPLE pass: vect
> testcase.c:5:1: internal compiler error: in verify_dominators, at
> dominance.cc:1194
> 0x742528 verify_dominators(cdi_direction)
> ...

that might be a different issue ...

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-08 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #10 from Zdenek Sojka  ---
Created attachment 57009
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57009=edit
simpler testcase using _BitInt()

$ x86_64-pc-linux-gnu-gcc -O3 -mavx2 testcase.c 
testcase.c: In function 'foo':
testcase.c:5:1: error: dominator of 24 should be 57, not 12
5 | foo (void)
  | ^~~
testcase.c:5:1: error: dominator of 25 should be 57, not 12
during GIMPLE pass: vect
testcase.c:5:1: internal compiler error: in verify_dominators, at
dominance.cc:1194
0x742528 verify_dominators(cdi_direction)
...

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2024-01-05 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #9 from Tamar Christina  ---
*** Bug 113145 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-29 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #8 from Tamar Christina  ---
Patch submitted

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-28 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #7 from David Binderman  ---
I see this one also, while building libmpg.

foundBugs $ ../results/bin/gcc -c -w -O3 bug993.c
foundBugs $ ../results/bin/gcc -c -w -O3 -march=znver3 bug993.c
src/libmpg123/format.c: In function ‘enc_chan_fit’:
src/libmpg123/format.c:188:12: error: dominator of 70 should be 206, not 3
src/libmpg123/format.c:188:12: error: dominator of 71 should be 206, not 3
during GIMPLE pass: vect
src/libmpg123/format.c:188:12: internal compiler error: in verify_dominators,
at dominance.cc:1194

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #6 from Tamar Christina  ---
Created attachment 56954
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56954=edit
candidate-patch1.patch

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #5 from Tamar Christina  ---
Loop seems to have been peeled and versioned, and has very convoluted sequence
of merge blocks for the exits.

I initially thought it would be enough to update the immediate reachable blocks
from the new exits.  But looks like I need to update any block of which they
are a parent of.

Patch work and now vectorizes the example.

Added to regression pile for today.

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-26 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

Tamar Christina  changed:

   What|Removed |Added

   Priority|P3  |P1
   Assignee|unassigned at gcc dot gnu.org  |tnfchris at gcc dot 
gnu.org
   Last reconfirmed||2023-12-26
 Status|UNCONFIRMED |ASSIGNED
   Target Milestone|--- |14.0
 Ever confirmed|0   |1

--- Comment #4 from Tamar Christina  ---
Thanks for the report and testcases.

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-26 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #3 from Tamar Christina  ---
loop has weird shape, peeling should have recalculated all dominators but seems
to have missed one.

Will fix tomorrow when back at work.

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-25 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #2 from Sam James  ---
Created attachment 56943
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56943=edit
reduced.i

[Bug tree-optimization/113144] [14 regression] ICE when building dpkg-1.21.15 in verify_dominators (error: dominator of 9 should be 48, not 12)

2023-12-25 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113144

--- Comment #1 from Sam James  ---
Created attachment 56942
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56942=edit
tarfn.i.xz