g++ -O3 -march=skylake-avx512 fails with ICE in verify_ssa with error: definition in block 11 does not dominate use in block 2 There are several trackers with the same error message, but some of them fails only with -O2 -floop-nest-optimize option (69675, 79483), other were fixed (71252). So i don't know, if this bug is duplicate or not. >$ cat repr.cpp extern short var_1; extern const short var_3; extern unsigned long int var_9; extern short var_13; extern const unsigned long int var_15; extern const unsigned long int var_37; extern unsigned long int var_40; extern long long int var_47; extern short var_48; extern const short var_54; extern long long int var_79; extern long long int var_81; extern long long int var_94; extern long long int var_95; extern long long int var_701; extern unsigned long int var_786; extern short var_788; extern long long int var_844; struct struct_1 { short member_1_2 : 30; static long long int member_1_3; }; extern struct_1 struct_obj_6; extern struct_1 struct_obj_8; void foo() { int a = var_3 <= 602154393864UL; if (var_81 ? 0 : var_3 && var_9) ; else { var_94 = 0; if (var_3 && var_48 || var_13) { if (var_48) var_95 = 0; short b((2364461588881776511UL + var_3) * (2 ? var_13 : 0) || var_1); struct_obj_8.member_1_2 = b; if (var_15) { if (var_81) if (var_47) ; else if (var_40) var_701 = 0; } else { if (var_40) var_79 = 0; if (var_54) { if (var_37) var_786 = 0; else var_788 = 0; struct_obj_6.member_1_3 = (2364461588881776511UL + var_3) * (2 ? var_13 : 0); } } if ((2364461588881776511UL + var_3) * (2 ? var_13 : 0)) var_844 = 0; } } } Error: >g++ -O3 -march=skylake-avx512 -c repr.cpp repr.cpp: In function ‘void foo()’: repr.cpp:28:6: error: definition in block 11 does not dominate use in block 2 void foo() { ^~~ for SSA_NAME: _10 in statement: slsr_104 = _10 * 2364461588881776511; during GIMPLE pass: slsr repr.cpp:28:6: internal compiler error: verify_ssa failed 0x1095c1b verify_ssa(bool, bool) /home/vsevolod/workspace/gcc-dev/trunk/gcc/tree-ssa.c:1188 0xd7ad1d execute_function_todo /home/vsevolod/workspace/gcc-dev/trunk/gcc/passes.c:1999 0xd7b619 execute_todo /home/vsevolod/workspace/gcc-dev/trunk/gcc/passes.c:2046 GCC version is 251301
Confirmed, started with r251264. Bit reduced test-case: short b, c, d, f, k, l, s; int e, g, h, i, j, m, n, o, p, q, r, t; long u; void v () { int a = c <= 602154393864UL; if (n ? 0 : c && e) ; else { o = 0; if (c && f || d) { if (f) p = 0; short w ((2364461588881776511UL + c) * (2 ? d : 0) || b); s = w; if (g) { if (n) if (j) ; else if (i) q = 0; } else { if (i) m = 0; if (k) { if (h) r = 0; else l = 0; u = (2364461588881776511UL + c) * (2 ? d : 0); } } if ((2364461588881776511UL + c) * (2 ? d : 0)) t = 0; } } }
I will have a looksee.
It looks like the SLSR issue is latent before the change. The change introduces IL differences in PRE: <bb 11> [54.69%] [count: INV]: - # prephitmp_66 = PHI <d.6_6(9), prephitmp_104(10), pretmp_105(30)> - pretmp_117 = _2; - pretmp_116 = c.0_1; + # prephitmp_72 = PHI <d.6_6(9), prephitmp_112(10), pretmp_113(33)> + # prephitmp_73 = PHI <c.0_1(9), c.0_1(10), c.0_1(33)> + # prephitmp_74 = PHI <_2(9), _2(10), _2(33)> the first CFG difference appears after VRP1 where we see a predecessor edge order difference. --- a/t.c.104t.vrp1 2017-08-28 11:14:39.031605121 +0200 +++ b/t.c.104t.vrp1 2017-08-28 11:14:33.247510516 +0200 @@ -294,10 +294,10 @@ ;; 7 ;; basic block 7, loop depth 0 -;; pred: 28 -;; 6 +;; pred: 6 +;; 28 ;; 5 - # .MEM_60 = PHI <.MEM_57(28), .MEM_59(6), .MEM_39(5)> + # .MEM_60 = PHI <.MEM_59(6), .MEM_57(28), .MEM_39(5)> # VUSE <.MEM_60> # rhs access alignment 16+0 d.6_6 = d; That's expected given we change the order we install edges in split_edge. The PRE IL change is also somewhat expected as it uses post-order on the inverted graph to compute ANTIC_IN and this order is dependent on the order of edges in pred. I will poke a bit to see why there's a difference in what PRE finally does. So Bill - can you look at the SLSR issue?
Sure, I'll try to get to this this week.
-march is not required. This repros on powerpc64le-linux-gnu as well with just -O3.
Patch submitted here: https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01743.html
Author: wschmidt Date: Wed Aug 30 20:04:07 2017 New Revision: 251547 URL: https://gcc.gnu.org/viewcvs?rev=251547&root=gcc&view=rev Log: [gcc] 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * gimple-ssa-strength-reduction.c (insert_initializers): Don't insert an initializer in a location not dominated by the stride definition. [gcc/testsuite] 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * g++.dg/torture/pr81987.C: New file. Added: trunk/gcc/testsuite/g++.dg/torture/pr81987.C Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-ssa-strength-reduction.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk so far. Holding this open until the fix is backported in about a week.
Author: wschmidt Date: Wed Sep 6 18:42:56 2017 New Revision: 251815 URL: https://gcc.gnu.org/viewcvs?rev=251815&root=gcc&view=rev Log: [gcc] 2017-09-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline: 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * gimple-ssa-strength-reduction.c (insert_initializers): Don't insert an initializer in a location not dominated by the stride definition. [gcc/testsuite] 2017-09-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline: 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * g++.dg/torture/pr81987.C: New file. Added: branches/gcc-7-branch/gcc/testsuite/g++.dg/torture/pr81987.C Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/gimple-ssa-strength-reduction.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
Author: wschmidt Date: Wed Sep 6 18:44:51 2017 New Revision: 251816 URL: https://gcc.gnu.org/viewcvs?rev=251816&root=gcc&view=rev Log: [gcc] 2017-09-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline: 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * gimple-ssa-strength-reduction.c (insert_initializers): Don't insert an initializer in a location not dominated by the stride definition. [gcc/testsuite] 2017-09-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline: 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * g++.dg/torture/pr81987.C: New file. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr81987.C Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/gimple-ssa-strength-reduction.c branches/gcc-6-branch/gcc/testsuite/ChangeLog
Author: wschmidt Date: Wed Sep 6 18:48:50 2017 New Revision: 251817 URL: https://gcc.gnu.org/viewcvs?rev=251817&root=gcc&view=rev Log: [gcc] 2017-09-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline: 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * gimple-ssa-strength-reduction.c (insert_initializers): Don't insert an initializer in a location not dominated by the stride definition. [gcc/testsuite] 2017-09-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline: 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * g++.dg/torture/pr81987.C: New file. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr81987.C Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/gimple-ssa-strength-reduction.c branches/gcc-5-branch/gcc/testsuite/ChangeLog
Now fixed everywhere. Thanks again for the report!