https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96354

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On July 28, 2020 4:45:59 PM GMT+02:00, "jakub at gcc dot gnu.org"
<gcc-bugzi...@gcc.gnu.org> wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96354
>
>--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
>So we have:
>  # DEBUG this => &<retval>
>  <retval> ={v} {CLOBBER};
>  # DEBUG D#1 => &<retval>.d
>  # DEBUG D#2 => MEM[(double *)&<retval>]
>  # DEBUG __trans_tmp_3 => D#2
>in matmul during inlining, and inline it as:
>  # DEBUG this => &D.2697[_13]
>  _24 = &D.2697[_13];
>  *_24 ={v} {CLOBBER};
>  # DEBUG D#1 => &D.2697[_13].d
>  # DEBUG D#2 => MEM[(double *)&D.2697[_13]]
>  # DEBUG __trans_tmp_3 => D#2
>  # DEBUG this => NULL
>Generally, we are more lax about IL restrictions we have in debug stmts
>compared to other stmts, e.g. verify_gimple_debug always returns false.
>So, do we want to allow this case?
>I believe cfgexpand.c handles that:
>    case MEM_REF:
>      if (!is_gimple_mem_ref_addr (TREE_OPERAND (exp, 0)))
>        {
>          tree newexp = fold_binary (MEM_REF, TREE_TYPE (exp),
>                                     TREE_OPERAND (exp, 0),
>                                     TREE_OPERAND (exp, 1));
>          if (newexp)
>            return expand_debug_expr (newexp);
>        }
>      /* FALLTHROUGH */
>    case INDIRECT_REF:
>or punts if the folding doesn't come up with anything.
>So, we could e.g. add bool is_debug argument to
>maybe_canonicalize_mem_ref_addr, pass true only when in GIMPLE_DEBUG
>and
>instead of failing the assertion there return false (what about the
>other
>assertions in there?).
>Or instead of bool is_debug take bool *is_debug and if non-NULL (only
>for
>GIMPLE_DEBUG) set it to *false if we'd otherwise fail and tell that way
>to the
>caller that it should reset the debug stmt?
>richi, your thoughts on this?

We could allow this in debug stmts but pretty much any (or very many) workers
on MEM_REFs will be quite unhappy about this. Of course we're not likely to run
them on debug stmts. But then, we do have debug Temps for this...

Reply via email to