[Bug c/101156] ICE: ‘verify_gimple’ failed, verify_gimple_in_seq(gimple*)

2021-06-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101156

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Richard Biener :

https://gcc.gnu.org/g:b4e21c80462682c4e6e5e487fe87107b27f8b4bd

commit r12-1729-gb4e21c80462682c4e6e5e487fe87107b27f8b4bd
Author: Richard Biener 
Date:   Tue Jun 22 12:13:44 2021 +0200

middle-end/101156 - remove not working optimization in gimplification

This removes a premature and not working optimization from the
gimplifier.  When gimplification is requested not to produce a SSA
name we try to avoid generating a copy when we did so anyway but
instead replace the LHS of its definition.  But that only works in
case there are no uses of the SSA name already which is something
we cannot easily check, so the following removes said optimization.

Statistics on the whole bootstrap shows we hit this optimization
only for libiberty/cp-demangle.c and overall we have 21652112
gimplifications where just 240 copies are elided.  Preserving
the optimization would require scanning the original expression
and the pre and post sequences for SSA names and uses, that seems
excessive to avoid these 240 copies.

2021-06-22  Richard Biener  

PR middle-end/101156
* gimplify.c (gimplify_expr): Remove premature incorrect
optimization.

* gcc.dg/pr101156.c: New testcase.

[Bug c/101156] ICE: ‘verify_gimple’ failed, verify_gimple_in_seq(gimple*)

2021-06-22 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101156

--- Comment #3 from Richard Biener  ---
OK, so the issue is we're calling gimplify_expr (, false /*allow_ssa*/)
on 'p--' and the gimplified sequence looks like the following on the pre_p
sequence:

 p.0_1 = p;
 p = p.0_1 + 18446744073709551612;

and the gimplify_expr result is just p.0_1.  Then we do

  /* Avoid the extra copy if possible.  */
  *expr_p = create_tmp_reg (TREE_TYPE (name));
  if (!gimple_nop_p (SSA_NAME_DEF_STMT (name)))
gimple_set_lhs (SSA_NAME_DEF_STMT (name), *expr_p);
  release_ssa_name (name);

but obviously that disregards that there's other uses of p.0_1 already.
I suppose the above might be premature optimization but I'm going to gather
some statistics on that I guess.

[Bug c/101156] ICE: ‘verify_gimple’ failed, verify_gimple_in_seq(gimple*)

2021-06-22 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101156

Richard Biener  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #2 from Richard Biener  ---
I will have a look.

[Bug c/101156] ICE: ‘verify_gimple’ failed, verify_gimple_in_seq(gimple*)

2021-06-22 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101156

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1
   Last reconfirmed||2021-06-22
 Status|UNCONFIRMED |NEW

--- Comment #1 from Martin Liška  ---
Started with r7-536-g381cdae49785fc4b.