From: Richard Guenther <richard.guenther@gmail.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix ICE in expand_cse_reciprocals (PR tree-optimization/42078)
Date: Thu, 19 Nov 2009 14:21:00 -0000 [thread overview]
Message-ID: <84fc9c000911190615v65576f2ahd76a0f28b3f725ae@mail.gmail.com> (raw)
In-Reply-To: <orpr7fgrib.fsf@livre.localdomain>
On Thu, Nov 19, 2009 at 3:47 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Nov 18, 2009, Alexandre Oliva <aoliva@redhat.com> wrote:
>
>> IMHO, the problem is that arg1 is being reused to hold its own
>> reciprocal. Should a different assignment of a newly-created SSA_NAME
>> be created instead, debug bind stmts would be automagically fixed upon
>> removal or replacement of the original assignment.
>
> I offer two patches below.
>
> They're built upon the understanding that reusing an SSA name's DEF for
> a different value is not kosher: it fails to update debug stmts and it
> might wreak havoc in any additional side information.
>
> gsi_replace will refuse to replace a stmt with one that sets a different
> SSA name, for similar reasons.
>
> The first patch reimplements the code that modified the call stmt in
> place, copying it instead, modifying the copy to set a different
> variable (just a different SSA name (*), in this case) to the modified
> value, inserting the copy before the original, and then removing the
> original stmt.
>
> Debug stmts that refer to the removed DEF are reset with the patch
> above. In order to enable the automatic propagation of debug stmts (and
> any other code that might be attempting to log or make sense of the
> transformations for any other purpose), we have to tell the compiler how
> the old DEF relates with the new one before removing the old one. This
> is what the second patch implements.
>
> Is the 1st ok to install? How about the 2nd, on top of the 1st?
I don't like the 2nd patch too much. As of the first one I agree
with the rationale but the implementation looks ugly (and
at least would need a comment).
Wouldn't
rarg1 = make_ssa_name (SSA_NAME_VAR (gimple_call_lhs (stmt1)), stmt1);
release_defs (stmt1);
gimple_call_set_lhs (stmt1, rarg1);
gimple_call_set_fndecl (stmt1);
update_stmt (stmt1);
work as well? That avoids the stmt duplication.
In fact this exchanging of the LHS (or rather invalidating of the
SSA name value) should be a helper function that knows
the implementation details and avoids going through releasing
and allocating the name.
Richard.
>
> (*) using the same SSA base variable is a bit of a hack. It might be
> easier on the eyes of someone looking at the dumps to actually create a
> tmp_var named after “recip” or somesuch. I couldn't convince myself
> this would do us significant good, and this code was slightly shorter,
> so I went ahead with it.
>
>
>
>
> --
> Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/ FSF Latin America board member
> Free Software Evangelist Red Hat Brazil Compiler Engineer
>
>
next prev parent reply other threads:[~2009-11-19 14:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 17:32 Jakub Jelinek
2009-11-18 19:56 ` Richard Guenther
2009-11-19 0:33 ` Alexandre Oliva
2009-11-19 3:06 ` Alexandre Oliva
2009-11-19 14:21 ` Richard Guenther [this message]
2009-11-20 9:44 ` Alexandre Oliva
2009-11-20 11:31 ` Richard Guenther
2009-11-21 6:31 ` Alexandre Oliva
2009-11-21 12:33 ` Richard Guenther
2009-11-20 11:56 ` Paolo Bonzini
2011-06-03 14:33 ` Alexandre Oliva
2012-04-09 6:37 ` Alexandre Oliva
2012-04-12 14:41 ` Richard Guenther
2012-06-13 21:57 ` Alexandre Oliva
2012-06-14 6:59 ` Alexandre Oliva
2009-11-19 13:44 ` Michael Matz
2009-11-19 14:05 ` Jakub Jelinek
2009-11-19 14:15 ` Michael Matz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84fc9c000911190615v65576f2ahd76a0f28b3f725ae@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=aoliva@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).