gcc-8.0.0-alpha20170903 snapshot (r251628) ICEs when compiling the following snippet w/ -O2, -O3, or -Ofast: int pj; void g4 (unsigned long int *bc, unsigned long int *h5) { if (pj != 0) { int ib = 0; while (bc != 0) { m6: for (pj = 0; pj < 2; ++pj) pj = 0; while (pj != 0) { for (;;) { } while (ib != 0) { unsigned long int tv = *bc; unsigned long int n7; *bc = 1; while (*bc != 0) { } ut: if (pj == 0) n7 = *h5 > 0; else { *h5 = tv; n7 = *h5; } ib += n7; } } } goto ut; } goto m6; } % gcc-8.0.0-alpha20170903 -O2 -c vbgefb2z.c during GIMPLE pass: pre vbgefb2z.c: In function 'g4': vbgefb2z.c:4:1: internal compiler error: in compute_antic, at tree-ssa-pre.c:2447 g4 (unsigned long int *bc, unsigned long int *h5) ^~
Confirmed, started with r249063.
Hum...
Not yet analyzed but I see LIM performs store-motion on <bb 8> [0.00%] [count: INV] [loop 5 header]: - *h5_26(D) = tv_24(D); + h5__lsm.7_18 = tv_24(D); where I think stores from undefined SSA names could be turned into CLOBBERs. "Fixes" the testcase. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 252002) +++ gcc/gimple-fold.c (working copy) @@ -410,6 +410,16 @@ fold_gimple_assign (gimple_stmt_iterator else if (DECL_P (rhs)) return get_symbol_constant_value (rhs); + + else if (TREE_CODE (rhs) == SSA_NAME + && SSA_NAME_IS_DEFAULT_DEF (rhs) + && ! ssa_defined_default_def_p (rhs) + && gimple_store_p (stmt)) + { + tree clobber = build_constructor (TREE_TYPE (rhs), NULL); + TREE_THIS_VOLATILE (clobber) = true; + return clobber; + } } break;
So we oscillate in the expression set because we "randomly" take expressions when intersecting ANTIC_OUT. Both keeping all and canonicalizing to lowest expression ID fixes this. Testing patch.
Author: rguenth Date: Mon Oct 23 09:20:14 2017 New Revision: 253998 URL: https://gcc.gnu.org/viewcvs?rev=253998&root=gcc&view=rev Log: 2017-10-23 Richard Biener <rguenther@suse.de> PR tree-optimization/82129 * tree-ssa-pre.c (bitmap_set_and): Remove. (compute_antic_aux): Compute ANTIC_OUT intersection in a way canonicalizing expressions in the set to those with lowest ID rather than taking that from the first edge. * gcc.dg/torture/pr82129.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/torture/pr82129.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-pre.c
Fixed.
Author: rguenth Date: Mon Oct 23 11:14:40 2017 New Revision: 254005 URL: https://gcc.gnu.org/viewcvs?rev=254005&root=gcc&view=rev Log: 2017-10-23 Richard Biener <rguenther@suse.de> PR tree-optimization/82129 Revert 2017-08-01 Richard Biener <rguenther@suse.de> PR tree-optimization/81181 * tree-ssa-pre.c (compute_antic_aux): Defer clean() to ... (compute_antic): ... end of iteration here. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-pre.c
Author: rguenth Date: Mon Oct 30 12:45:53 2017 New Revision: 254218 URL: https://gcc.gnu.org/viewcvs?rev=254218&root=gcc&view=rev Log: 2017-10-30 Richard Biener <rguenther@suse.de> PR tree-optimization/82762 Revert 2017-10-23 Richard Biener <rguenther@suse.de> PR tree-optimization/82129 Revert 2017-08-01 Richard Biener <rguenther@suse.de> PR tree-optimization/81181 * tree-ssa-pre.c (compute_antic_aux): Defer clean() to ... (compute_antic): ... end of iteration here. * gcc.dg/torture/pr82762.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/torture/pr82762.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-pre.c