public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
@ 2024-01-04 17:49 jamborm at gcc dot gnu.org
  2024-01-04 17:52 ` [Bug tree-optimization/113237] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2024-01-04 17:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113237
           Summary: [14 Regression] ICE verify_ssa failed when building
                    500.perlbench_r since r14-6822-g01f4251b8775c8
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jamborm at gcc dot gnu.org
                CC: tnfchris at gcc dot gnu.org
            Blocks: 26163
  Target Milestone: ---
              Host: x86_64-linux
            Target: x86_64-linux

With a compiler configured with --enable-checking=yes and the following
testcase derived from 500.perlbench_r with -O3 -march=x86-64-v3 I get a
verify_ssa ICE:

$ cat test.c 
long Perl_pp_split_limit;
int Perl_block_gimme();
int Perl_pp_split() {
  char strend;
  long iters;
  int gimme = Perl_block_gimme();
  while (--Perl_pp_split_limit) {
    if (gimme)
      iters++;
    if (strend)
      break;
  }
  if (iters)
    return 0;
}

$ $PREFIX/gcc -O3 -march=x86-64-v3  -S test.c 
test.c: In function ‘Perl_pp_split’:
test.c:3:5: error: definition in block 4 does not dominate use in block 6
    3 | int Perl_pp_split() {
      |     ^~~~~~~~~~~~~
for SSA_NAME: vect_iters_12.12_110 in statement:
vect_iters_12.12_111 = PHI <vect_iters_12.12_110(6)>
PHI argument
vect_iters_12.12_110
for PHI node
vect_iters_12.12_111 = PHI <vect_iters_12.12_110(6)>
during GIMPLE pass: vect
test.c:3:5: internal compiler error: verify_ssa failed
0x129673f verify_ssa(bool, bool)
        /home/mjambor/gcc/mine/src/gcc/tree-ssa.cc:1203
0xf0bcd5 execute_function_todo
        /home/mjambor/gcc/mine/src/gcc/passes.cc:2095
0xf0c13e execute_todo
        /home/mjambor/gcc/mine/src/gcc/passes.cc:2142
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

I have bisected the failure to r14-6822-g01f4251b8775c8 (middle-end: Support
vectorization of loops with multiple exits).  I have tried if the patch
attached to PR 113137 helps but unfortunately it does not.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/113237] [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
  2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
@ 2024-01-04 17:52 ` pinskia at gcc dot gnu.org
  2024-01-04 18:00 ` tnfchris at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-04 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/113237] [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
  2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
  2024-01-04 17:52 ` [Bug tree-optimization/113237] " pinskia at gcc dot gnu.org
@ 2024-01-04 18:00 ` tnfchris at gcc dot gnu.org
  2024-01-04 18:02 ` tnfchris at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-01-04 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
> I have bisected the failure to r14-6822-g01f4251b8775c8 (middle-end: Support
> vectorization of loops with multiple exits).  I have tried if the patch
> attached to PR 113137 helps but unfortunately it does not.

Indeed this should be fixed by the patch in PR 113136 not 113137 :)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/113237] [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
  2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
  2024-01-04 17:52 ` [Bug tree-optimization/113237] " pinskia at gcc dot gnu.org
  2024-01-04 18:00 ` tnfchris at gcc dot gnu.org
@ 2024-01-04 18:02 ` tnfchris at gcc dot gnu.org
  2024-01-04 18:48 ` tnfchris at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-01-04 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Ah wait, I see. Ok, taking a look.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/113237] [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
  2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-04 18:02 ` tnfchris at gcc dot gnu.org
@ 2024-01-04 18:48 ` tnfchris at gcc dot gnu.org
  2024-01-07 17:27 ` tnfchris at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-01-04 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Last reconfirmed|                            |2024-01-04
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |tnfchris at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #3 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Thanks,

Indeed the patch for PR 113137 won't fix this one as it looks like the peeling
code has gotten confused about which exit is which when adjusting
virtual_operands.

It looks like it's swapped them, and this happens because non of the loop exits
are counting one so it just picks a random one.

Looks the one it picks is not the latch connected one:

perl.c:10:8: note:   using as main loop exit: 11 -> 7 [AUX: (nil)]
perl.c:10:8: note:    === get_loop_niters ===
perl.c:10:8: note:    Loop has 2 exits.
perl.c:10:8: note:    Analyzing exit 0...
perl.c:10:8: note:    Analyzing exit 1...

which then incorrectly peels:

 # iters_46 = PHI <iters_12(21), iters_4(26)>

which should be:

 # iters_46 = PHI <iters_4(21), iters_12(26)>

I started implemented a fix for this same situation earlier for PR 113178 but
didn't finish it because I didn't think we'd get this far with a legit loop.

I'll finish that part.  Thanks for the testcase!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/113237] [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
  2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-04 18:48 ` tnfchris at gcc dot gnu.org
@ 2024-01-07 17:27 ` tnfchris at gcc dot gnu.org
  2024-01-12 15:32 ` cvs-commit at gcc dot gnu.org
  2024-01-12 15:36 ` tnfchris at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-01-07 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Created attachment 57003
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57003&action=edit
perlbench.patch

submitted patch

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/113237] [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
  2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-07 17:27 ` tnfchris at gcc dot gnu.org
@ 2024-01-12 15:32 ` cvs-commit at gcc dot gnu.org
  2024-01-12 15:36 ` tnfchris at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-12 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC 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:99c0a540d6689ede068f9ba98af6f38c3cd71362

commit r14-7196-g99c0a540d6689ede068f9ba98af6f38c3cd71362
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Fri Jan 12 15:25:58 2024 +0000

    middle-end: thread through existing LCSSA variable for alternative exits
too [PR113237]

    Builing on top of the previous patch, similar to when we have a single exit
if
    we have a case where all exits are considered early exits and there are
existing
    non virtual phi then in order to maintain LCSSA we have to use the existing
PHI
    variables.  We can't simply clear them and just rebuild them because the
order
    of the PHIs in the main exit must match the original exit for when we add
the
    skip_epilog guard.

    But the infrastructure is already in place to maintain them, we just have
to use
    the right value.

    gcc/ChangeLog:

            PR tree-optimization/113237
            * tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
Use
            existing LCSSA variable for exit when all exits are early break.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/113237
            * gcc.dg/vect/vect-early-break_98-pr113237.c: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/113237] [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8
  2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-01-12 15:32 ` cvs-commit at gcc dot gnu.org
@ 2024-01-12 15:36 ` tnfchris at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2024-01-12 15:36 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Fixed. Thanks for the report and let me know if there's something still broken.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-12 15:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-04 17:49 [Bug tree-optimization/113237] New: [14 Regression] ICE verify_ssa failed when building 500.perlbench_r since r14-6822-g01f4251b8775c8 jamborm at gcc dot gnu.org
2024-01-04 17:52 ` [Bug tree-optimization/113237] " pinskia at gcc dot gnu.org
2024-01-04 18:00 ` tnfchris at gcc dot gnu.org
2024-01-04 18:02 ` tnfchris at gcc dot gnu.org
2024-01-04 18:48 ` tnfchris at gcc dot gnu.org
2024-01-07 17:27 ` tnfchris at gcc dot gnu.org
2024-01-12 15:32 ` cvs-commit at gcc dot gnu.org
2024-01-12 15:36 ` tnfchris at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).