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.
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.
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.
Fixed on trunk sofar.
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.
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)
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)
Fixed.