[Bug tree-optimization/80620] [8 Regression] gcc produces wrong code with -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80620 --- Comment #8 from Richard Biener --- Author: rguenth Date: Tue Jul 18 07:35:40 2017 New Revision: 250297 URL: https://gcc.gnu.org/viewcvs?rev=250297&root=gcc&view=rev Log: 2017-07-18 Richard Biener PR tree-optimization/80620 PR tree-optimization/81403 * tree-ssa-pre.c (phi_translate_1): Clear range and points-to info when re-using a VN table entry. * gcc.dg/torture/pr80620.c: New testcase. * gcc.dg/torture/pr81403.c: Likewise. Added: trunk/gcc/testsuite/gcc.dg/torture/pr80620.c trunk/gcc/testsuite/gcc.dg/torture/pr81403.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-pre.c
[Bug tree-optimization/80620] [8 Regression] gcc produces wrong code with -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80620 Richard Biener changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Richard Biener --- Now really fixed.
[Bug tree-optimization/80620] [8 Regression] gcc produces wrong code with -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80620 Richard Biener changed: What|Removed |Added Status|NEW |ASSIGNED Version|7.0.1 |8.0 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Target Milestone|7.2 |8.0 Summary|[7/8 Regression] gcc|[8 Regression] gcc produces |produces wrong code with|wrong code with -O3 |-O3 | --- Comment #5 from Richard Biener --- The rev. is not on the GCC 7 branch. I will have a look.
[Bug tree-optimization/80620] [8 Regression] gcc produces wrong code with -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80620 --- Comment #6 from Richard Biener --- Ugh. This is really another latent issue with PRE and range-info. When PHI-translating {bit_and_expr,a.12_17,4081116982543369} when valueizing a.12_17 we end up with a leader for a.12_17 as {nop_expr,a.6_10} (as this is in antic-in). We then translate that as {nop_expr,a.0_1} for which we have a.4_4 as "representative" -- but this has range-info that isn't valid in the context we are looking at, when we the simplify using match.pd we use that range-info and BOOM!. The rev. in question just made this more likely to trigger (previously only match.pd simplifications to constants were considered).
[Bug tree-optimization/80620] [8 Regression] gcc produces wrong code with -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80620 --- Comment #7 from Richard Biener --- Now needs sth before r247596 to reproduce. The whole PRE_EXPR_NARY (expr) = newnary; constant = fully_constant_expression (expr); PRE_EXPR_NARY (expr) = nary; if (constant != expr) { /* For non-CONSTANTs we have to make sure we can eventually insert the expression. Which means we need to have a leader for it. */ if (constant->kind != CONSTANT) { /* Do not allow simplifications to non-constants over backedges as this will likely result in a loop PHI node to be inserted and increased register pressure. See PR77498 - this avoids doing predcoms work in a less efficient way. */ if (find_edge (pred, phiblock)->flags & EDGE_DFS_BACK) ; else { unsigned value_id = get_expr_value_id (constant); constant = find_leader_in_sets (value_id, set1, set2, AVAIL_OUT (pred)); if (constant) return constant; mitigates the fact that tree result = vn_nary_op_lookup_pieces (newnary->length, newnary->opcode, newnary->type, &newnary->op[0], &nary); if (result && is_gimple_min_invariant (result)) return get_or_alloc_expr_for_constant (result); doesn't allow SSA name result to prevail here. That is vn_nary_simplify also just looks up the expr now even if not simplified. It also gets fed leaders which are not necessarily final values and thus do not have range-info cleared. The SCCVN band-aid to clear SSA_NAME_RANGE_INFO doesn't apply here because nothing is value-numbered to a.4_4 besides itself. But phi-translation effectively value-numbers an expression to it.