* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
@ 2023-10-19 12:07 ` zsojka at seznam dot cz
2023-10-19 13:45 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2023-10-19 12:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> ---
The correct version output for gcc-14 is:
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-4743-20231019111223-g947fb34a165-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-4743-20231019111223-g947fb34a165-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231019 (experimental) (GCC)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
2023-10-19 12:07 ` [Bug tree-optimization/111878] " zsojka at seznam dot cz
@ 2023-10-19 13:45 ` rguenth at gcc dot gnu.org
2023-10-19 18:45 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-19 13:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
2023-10-19 12:07 ` [Bug tree-optimization/111878] " zsojka at seznam dot cz
2023-10-19 13:45 ` rguenth at gcc dot gnu.org
@ 2023-10-19 18:45 ` pinskia at gcc dot gnu.org
2023-10-19 18:49 ` [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite pinskia at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-19 18:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-10-19
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
`-O3 -fgraphite-identity -fdump-tree-graphite` will also cause the ICE.
The code in graphite is:
dump_user_location_t loc = find_loop_location
(scops[i]->scop_info->region.entry->dest->loop_father);
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
"loop nest optimized\n");
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
` (2 preceding siblings ...)
2023-10-19 18:45 ` pinskia at gcc dot gnu.org
@ 2023-10-19 18:49 ` pinskia at gcc dot gnu.org
2023-10-30 17:50 ` [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info jamborm at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-19 18:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14 Regression] ICE: in |[14 Regression] ICE: in
|get_loop_exit_edges, at |get_loop_exit_edges, at
|cfgloop.cc:1204 with -O3 |cfgloop.cc:1204 with -O3
|-fgraphite-identity |-fgraphite-identity
|-fsave-optimization-record |-fsave-optimization-record/
| |-fdump-tree-graphite
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
If we wrap the whole function inside a loop, there is no crash.
That is:
```
int long_c2i_ltmp;
int *long_c2i_cont;
void
long_c2i (long utmp, int i)
{
for(int j = 0; j < 100; j++)
{
int neg = 1;
switch (long_c2i_cont[0])
case 0:
neg = 0;
for (; i; i++)
if (neg)
utmp |= long_c2i_cont[i] ^ 5;
else
utmp |= long_c2i_cont[i];
long_c2i_ltmp = utmp;
}
}
```
That is because the loop that is being chosen here for the `->loop_father` is
the outer most loop (that was just added).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
` (3 preceding siblings ...)
2023-10-19 18:49 ` [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite pinskia at gcc dot gnu.org
@ 2023-10-30 17:50 ` jamborm at gcc dot gnu.org
2023-10-31 6:30 ` sjames at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-10-30 17:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I am not 100% certain if it is the same bug (I am happy to open a separate bug
report if not), but I'm getting an ICE on the same spot, also with graphite,
when running
gfortran ~/gcc/trunk/src/libgomp/testsuite/libgomp.fortran/simd7.f90
-floop-nest-optimize -O1
with master revision 89e97f655d6 gfortran (and the above libgomp test).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
` (4 preceding siblings ...)
2023-10-30 17:50 ` [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info jamborm at gcc dot gnu.org
@ 2023-10-31 6:30 ` sjames at gcc dot gnu.org
2023-10-31 8:57 ` [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info since r14-4708-gd65e38e616e7ac sjames at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-31 6:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
Again suppressed by -fharden-control-flow-redundancy.
Anyway, will bisect.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info since r14-4708-gd65e38e616e7ac
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
` (5 preceding siblings ...)
2023-10-31 6:30 ` sjames at gcc dot gnu.org
@ 2023-10-31 8:57 ` sjames at gcc dot gnu.org
2023-10-31 11:09 ` tnfchris at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-31 8:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tnfchris at gcc dot gnu.org
Summary|[14 Regression] ICE: in |[14 Regression] ICE: in
|get_loop_exit_edges, at |get_loop_exit_edges, at
|cfgloop.cc:1204 with -O3 |cfgloop.cc:1204 with -O3
|-fgraphite-identity |-fgraphite-identity
|-fsave-optimization-record/ |-fsave-optimization-record/
|-fdump-tree-graphite/-fopt- |-fdump-tree-graphite/-fopt-
|info |info since
| |r14-4708-gd65e38e616e7ac
--- Comment #6 from Sam James <sjames at gcc dot gnu.org> ---
d65e38e616e7ac8157ef04b55beb6670f2c0f142 is the first bad commit
commit d65e38e616e7ac8157ef04b55beb6670f2c0f142
Author: Tamar Christina <tamar.christina@arm.com>
Date: Wed Oct 18 09:02:12 2023 +0100
middle-end: Refactor vectorizer loop conditionals and separate out IV to
new variables
i.e. r14-4708-gd65e38e616e7ac
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info since r14-4708-gd65e38e616e7ac
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
` (6 preceding siblings ...)
2023-10-31 8:57 ` [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info since r14-4708-gd65e38e616e7ac sjames at gcc dot gnu.org
@ 2023-10-31 11:09 ` tnfchris at gcc dot gnu.org
2023-11-16 12:12 ` cvs-commit at gcc dot gnu.org
2023-11-16 12:14 ` tnfchris at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2023-10-31 11:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
Tamar Christina <tnfchris at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |tnfchris at gcc dot gnu.org
--- Comment #7 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Thanks for the report.
Graphite is feeding it a junk loop. The loop's latch block is invalid. In fact
the block isn't even part of the loop.
Since the loop structure Graphite passes it is broken, get_loop_exit_edges (..)
asserts.
Previously for this situation the call would silently return NULL for such
loops.
I'd argue this is a bug in Graphite, but will restore the return NULL for
broken loops.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info since r14-4708-gd65e38e616e7ac
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
` (7 preceding siblings ...)
2023-10-31 11:09 ` tnfchris at gcc dot gnu.org
@ 2023-11-16 12:12 ` cvs-commit at gcc dot gnu.org
2023-11-16 12:14 ` tnfchris at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-16 12:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <tnfchris@gcc.gnu.org>:
https://gcc.gnu.org/g:7a496b7ce105185be12e023e749c90d5f7561879
commit r14-5529-g7a496b7ce105185be12e023e749c90d5f7561879
Author: Tamar Christina <tamar.christina@arm.com>
Date: Thu Nov 16 12:11:22 2023 +0000
middle-end: skip checking loop exits if loop malformed [PR111878]
Before my refactoring if the loop->latch was incorrect then
find_loop_location
skipped checking the edges and would eventually return a dummy location.
It turns out that a loop can have
loops_state_satisfies_p (LOOPS_HAVE_RECORDED_EXITS) but also not have a
latch
in which case get_loop_exit_edges traps.
This restores the old behavior.
gcc/ChangeLog:
PR tree-optimization/111878
* tree-vect-loop-manip.cc (find_loop_location): Skip edges check if
latch incorrect.
gcc/testsuite/ChangeLog:
PR tree-optimization/111878
* gcc.dg/graphite/pr111878.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/111878] [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record/-fdump-tree-graphite/-fopt-info since r14-4708-gd65e38e616e7ac
2023-10-19 11:57 [Bug tree-optimization/111878] New: [14 Regression] ICE: in get_loop_exit_edges, at cfgloop.cc:1204 with -O3 -fgraphite-identity -fsave-optimization-record zsojka at seznam dot cz
` (8 preceding siblings ...)
2023-11-16 12:12 ` cvs-commit at gcc dot gnu.org
@ 2023-11-16 12:14 ` tnfchris at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2023-11-16 12:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
Tamar Christina <tnfchris at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Fixed, thanks for the report.
^ permalink raw reply [flat|nested] 11+ messages in thread