https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94963
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-05-06 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Target Milestone|--- |11.0 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. I've met the underlying issue when developing the patch and for this reason marked the conditional store inserted by LIM with no-warning. But for the testcase that's not enough since now PRE comes along and optimizes the var.field load away, re-exposing the issue. LIM transforms the testcase to (simplified a bit) void f (void) { if (pv != 0) { bool v2_set = false; bool varfield_set = false; int v2tem, varfield_tem; for (const P *ph = pv; ph < &pv[ps]; ++ph) switch (ph->p1) { case 1: v2tem = ph->p2; v2_set = true; break; case 2: varfield_tem = ph->p3; varfield_set = true; break; } if (varfield_set) var.field = varfield_tem; if (v2_set) v2 = v2tem; } if (var.field != 0) foo (&var); } where the uninit predicate analysis doesn't grok the relation between varfield_set and varfield_tem being initialized. The patch changed code generation to elide the previously emitted unconditional load of v2 and var.field. I suspected that for the case where there is no load the loop PHI for varfield_tem might be eliminated, but it is not in all cases it seems. Now apart from marking the store no-warning we could easily initialize the tems on loop entry, just not with their true value but for example with zero. That might result in less optimal out-of-SSA though (no coalescing with constants, the constant move needs to be emitted...) at least when the loop PHI is not eliminated. What works is initializing with an uninitialized variable marked TREE_NO_WARNING. I'm going to test that (eliding the no-warning on the conditional stores).