Bug 94964 - [8 Regression] ICE in add_phi_arg, at tree-phinodes.c:359 since r8-2993-ga7976089dba5e227
Summary: [8 Regression] ICE in add_phi_arg, at tree-phinodes.c:359 since r8-2993-ga797...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 10.0
: P2 normal
Target Milestone: 8.5
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-05-06 07:50 UTC by Martin Liška
Modified: 2020-12-01 14:03 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 10.1.1, 11.0, 7.4.0, 8.4.1, 9.3.1
Known to fail: 10.1.0, 8.3.0, 8.4.0, 9.3.0
Last reconfirmed: 2020-05-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2020-05-06 07:50:20 UTC
Quite old issue:

$ gcc /home/marxin/Programming/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eh990323-5.C -fno-tree-sink -fno-guess-branch-probability -fno-tree-ch -finline-small-functions -O1 --param=early-inlining-insns=100 -fpredictive-commoning -c
during GIMPLE pass: pcom
/home/marxin/Programming/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eh990323-5.C: In function ‘void f()’:
/home/marxin/Programming/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eh990323-5.C:41:6: internal compiler error: in add_phi_arg, at tree-phinodes.c:359
   41 | void f()
      |      ^
0x7eb110 add_phi_arg(gphi*, tree_node*, edge_def*, unsigned int)
	/home/marxin/Programming/gcc/gcc/tree-phinodes.c:359
0x1162f37 initialize_root_vars_lm
	/home/marxin/Programming/gcc/gcc/tree-predcom.c:1969
0x1162f37 execute_load_motion
	/home/marxin/Programming/gcc/gcc/tree-predcom.c:2001
0x1162f37 execute_pred_commoning
	/home/marxin/Programming/gcc/gcc/tree-predcom.c:2265
0x11654f2 tree_predictive_commoning_loop
	/home/marxin/Programming/gcc/gcc/tree-predcom.c:3308
0x11654f2 tree_predictive_commoning()
	/home/marxin/Programming/gcc/gcc/tree-predcom.c:3333
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 1 Richard Biener 2020-05-06 08:00:50 UTC
Mine.  The loop does not have a preheader we can sink to so gsi_insert_seq_on_edge_immediate will split the edge and the following
add_phi_arg breaks.

Now, the loop entry edge is an EH edge in this case, will dig what
the appropriate solution is.
Comment 2 GCC Commits 2020-05-06 11:37:07 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:6fc00b41e764219e2c88d8892d7c701c0d292a17

commit r11-139-g6fc00b41e764219e2c88d8892d7c701c0d292a17
Author: Richard Biener <rguenther@suse.de>
Date:   Wed May 6 10:23:15 2020 +0200

    middle-end/94964 - avoid EH loop entry with CP_SIMPLE_PREHEADERS
    
    Loop optimizers expect to be able to insert on the preheader
    edge w/o splitting it thus avoid ending up with a preheader
    that enters the loop via an EH edge (or an abnormal edge).
    
    2020-05-06  Richard Biener  <rguenther@suse.de>
    
            PR middle-end/94964
            * cfgloopmanip.c (create_preheader): Require non-complex
            preheader edge for CP_SIMPLE_PREHEADERS.
Comment 3 Richard Biener 2020-05-06 11:37:50 UTC
Fixed on trunk sofar.
Comment 4 GCC Commits 2020-06-23 11:06:21 UTC
The releases/gcc-10 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

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

commit r10-8347-gfb2b8bf32b72a7976b2bdea1fa04c8af50786429
Author: Richard Biener <rguenther@suse.de>
Date:   Wed May 6 10:23:15 2020 +0200

    middle-end/94964 - avoid EH loop entry with CP_SIMPLE_PREHEADERS
    
    Loop optimizers expect to be able to insert on the preheader
    edge w/o splitting it thus avoid ending up with a preheader
    that enters the loop via an EH edge (or an abnormal edge).
    
    2020-05-06  Richard Biener  <rguenther@suse.de>
    
            PR middle-end/94964
            * cfgloopmanip.c (create_preheader): Require non-complex
            preheader edge for CP_SIMPLE_PREHEADERS.
Comment 5 GCC Commits 2020-09-11 10:38:09 UTC
The releases/gcc-9 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:95a8572ce7bdf152cc8c7d069ce24508a9ff0bfe

commit r9-8864-g95a8572ce7bdf152cc8c7d069ce24508a9ff0bfe
Author: Richard Biener <rguenther@suse.de>
Date:   Wed May 6 10:23:15 2020 +0200

    middle-end/94964 - avoid EH loop entry with CP_SIMPLE_PREHEADERS
    
    Loop optimizers expect to be able to insert on the preheader
    edge w/o splitting it thus avoid ending up with a preheader
    that enters the loop via an EH edge (or an abnormal edge).
    
    2020-05-06  Richard Biener  <rguenther@suse.de>
    
            PR middle-end/94964
            * cfgloopmanip.c (create_preheader): Require non-complex
            preheader edge for CP_SIMPLE_PREHEADERS.
    
    (cherry picked from commit 6fc00b41e764219e2c88d8892d7c701c0d292a17)
Comment 6 GCC Commits 2020-12-01 14:02:41 UTC
The releases/gcc-8 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:70ac96884811b6971b44a7ffa94d637f612e6cc4

commit r8-10660-g70ac96884811b6971b44a7ffa94d637f612e6cc4
Author: Richard Biener <rguenther@suse.de>
Date:   Wed May 6 10:23:15 2020 +0200

    middle-end/94964 - avoid EH loop entry with CP_SIMPLE_PREHEADERS
    
    Loop optimizers expect to be able to insert on the preheader
    edge w/o splitting it thus avoid ending up with a preheader
    that enters the loop via an EH edge (or an abnormal edge).
    
    2020-05-06  Richard Biener  <rguenther@suse.de>
    
            PR middle-end/94964
            * cfgloopmanip.c (create_preheader): Require non-complex
            preheader edge for CP_SIMPLE_PREHEADERS.
    
    (cherry picked from commit 6fc00b41e764219e2c88d8892d7c701c0d292a17)
Comment 7 Richard Biener 2020-12-01 14:03:24 UTC
Fixed.