Bug 96349 - [10 Regression] ICE: SSA corruption (Unable to coalesce ssa_names 2 and 3 which are marked as MUST COALESCE.) [in fail_abnormal_edge_coalesce]
Summary: [10 Regression] ICE: SSA corruption (Unable to coalesce ssa_names 2 and 3 whi...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P2 normal
Target Milestone: 10.3
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-07-28 01:59 UTC by Arseny Solokha
Modified: 2020-09-11 12:12 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 10.2.1, 11.0
Known to fail: 10.2.0
Last reconfirmed: 2020-07-28 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2020-07-28 01:59:45 UTC
gcc-11.0.0-alpha20200726 snapshot (g:39ddfef9a5c24acf6412236f52f6716c8e0ebc9e) ICEs when compiling the following testcase w/ -O3:

void __attribute__ ((returns_twice))
gr (void);

void
ib (void);

void
zg (void);

void
yw (int uz)
{
  gr ();

  for (;;)
    if (uz != 0)
      {
        uz = 0;
        ib ();
      }
    else
      zg ();
}

% gcc-11.0.0 -O3 -c kl7mlgao.c

Unable to coalesce ssa_names 2 and 3 which are marked as MUST COALESCE.
uz_2(ab) and  uz_3(ab)
during RTL pass: expand
kl7mlgao.c: In function 'yw':
kl7mlgao.c:11:1: internal compiler error: SSA corruption
   11 | yw (int uz)
      | ^~
0xedadfa fail_abnormal_edge_coalesce
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-ssa-coalesce.c:1003
0xedadfa coalesce_partitions
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-ssa-coalesce.c:1425
0xedadfa coalesce_ssa_name(_var_map*)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-ssa-coalesce.c:1755
0xe78937 remove_ssa_form
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-outof-ssa.c:1065
0xe78937 rewrite_out_of_ssa(ssaexpand*)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-outof-ssa.c:1323
0x912f80 execute
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/cfgexpand.c:6377
Comment 1 Richard Biener 2020-07-28 06:10:46 UTC
Confirmed, I'll take a look.
Comment 2 Richard Biener 2020-07-28 06:13:46 UTC
-fno-split-loops fixes it.

t.c:16:8: optimized: loop split on semi-invariant condition at false branch

so it's the new splitting code, still going to give it a quick shot at a fix.
Comment 3 Martin Liška 2020-07-28 07:23:55 UTC
Started with r10-4447-g095f78c62157124a, but it's just an inroduction of a param that exposed it.
Comment 4 CVS Commits 2020-07-29 11:47:36 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:2b2f3867c09c8977268b8ffbd646ac242188b335

commit r11-2402-g2b2f3867c09c8977268b8ffbd646ac242188b335
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Jul 28 09:45:52 2020 +0200

    tree-optimization/96349 - avoid abnormal coalescing issues in loop split
    
    This avoids splitting a loop when the entry value of a loop PHI is
    involved with abnormal coalescing.
    
    2020-07-28  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/96349
            * tree-ssa-loop-split.c (stmt_semi_invariant_p_1): When the
            condition runs into a loop PHI with an abnormal entry value give up.
    
            * gcc.dg/torture/pr96349.c: New testcase.
Comment 5 CVS Commits 2020-09-11 12:11:51 UTC
The releases/gcc-10 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:d1f9b13fd45f9c7ca6c5dd31245705388645f306

commit r10-8744-gd1f9b13fd45f9c7ca6c5dd31245705388645f306
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Jul 28 09:45:52 2020 +0200

    tree-optimization/96349 - avoid abnormal coalescing issues in loop split
    
    This avoids splitting a loop when the entry value of a loop PHI is
    involved with abnormal coalescing.
    
    2020-07-28  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/96349
            * tree-ssa-loop-split.c (stmt_semi_invariant_p_1): When the
            condition runs into a loop PHI with an abnormal entry value give up.
    
            * gcc.dg/torture/pr96349.c: New testcase.
    
    (cherry picked from commit 2b2f3867c09c8977268b8ffbd646ac242188b335)
Comment 6 Richard Biener 2020-09-11 12:12:17 UTC
Fixed.