From: Jeff Law <law@redhat.com>
To: Kyrill Tkachov <kyrylo.tkachov@arm.com>,
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][RTL-ifcvt] Make non-conditional execution if-conversion more aggressive
Date: Fri, 24 Jul 2015 18:44:00 -0000 [thread overview]
Message-ID: <55B28737.5040403@redhat.com> (raw)
In-Reply-To: <55B205F5.3080005@arm.com>
On 07/24/2015 03:31 AM, Kyrill Tkachov wrote:
>> Wouldn't it be better to walk BB_A, gathering the set of all the
>> registers modified, then do a single walk through BB testing for uses of
>> those registers?
>
> I think so, yes. I'll try that.
You might look at resource.c -- I haven't looked at it in a long time,
but it might have many of the interfaces you need to do this kind of
book keeping.
>
>> Don't you have to be careful with MEMs in both blocks?
>
> bb_valid_for_noce_process_p called earlier in the chain should have
> rejected memory operands already.
>
>>
>>
>>
>>
>>
>>
>>> +
>>> +/* Helper for noce_try_cmove_arith. Emit the pattern TO_EMIT and
>>> return
>>> + the resulting insn or NULL if it's not a valid insn. */
>>> +
>>> +static rtx_insn *
>>> +noce_emit_insn (rtx to_emit)
>>> +{
>>> + gcc_assert (to_emit);
>>> + rtx_insn *insn = emit_insn (to_emit);
>>> +
>>> + if (recog_memoized (insn) < 0)
>>> + return NULL;
>>> +
>>> + return insn;
>>> +}
>>> +
>>> +/* Helper for noce_try_cmove_arith. Emit a copy of the insns up to
>>> + and including the penultimate one in BB if it is not simple
>>> + (as indicated by SIMPLE). Then emit LAST_INSN as the last
>>> + insn in the block. The reason for that is that LAST_INSN may
>>> + have been modified by the preparation in noce_try_cmove_arith. */
>>> +
>>> +static bool
>>> +noce_emit_bb (rtx last_insn, basic_block bb, bool simple)
>>> +{
>>> + if (bb && !simple)
>>> + noce_emit_all_but_last (bb);
>>> +
>>> + if (last_insn && !noce_emit_insn (last_insn))
>>> + return false;
>>> +
>>> + return true;
>>> +}
>> Under what conditions can noce_emit_insn fail and what happens to the
>> insn stream if it does? It seems to me like the insn stream would be
>> bogus and we should stop compilation. Which argues that rather than
>> returning a bool, we should just assert that the insn is memoized and
>> remove the check in noce_emit_bb.
>>
>> Or is it the case that we're emitting onto a sequence that we can just
>> throw away in the event of a failure?
>
> It fails when the last insn is not recognised, because
> noce_try_cmove_arith can modify the last insn, but I have
> not seen it cause any trouble. If it fails then back in
> noce_try_cmove_arith we goto end_seq_and_fail which ends
> the sequence and throws it away (and cancels if-conversion
> down that path), so it should be safe.
OK, I was working for the assumption that memoization ought not fail,
but it seems that was a bad assumption on my part. So given
noce_try_cmove_arith can change the last insn and make it
no-recognizable this code seems reasoanble.
So I think the only outstanding issues are:
1. Investigate moving rather than re-emitting insns.
2. Investigate a more efficient means to find set/use conflicts
between the two blocks, possibly using resource.[ch]
jeff
next prev parent reply other threads:[~2015-07-24 18:43 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 12:31 Kyrill Tkachov
2015-07-10 13:05 ` Kyrill Tkachov
2015-07-10 23:00 ` Bernhard Reutner-Fischer
2015-07-10 23:08 ` Bernhard Reutner-Fischer
2015-07-13 9:46 ` Kyrill Tkachov
2015-07-13 10:00 ` Kyrill Tkachov
2015-07-13 10:48 ` Bernhard Reutner-Fischer
2015-07-13 13:12 ` Kyrill Tkachov
2015-07-13 14:03 ` Kyrill Tkachov
2015-07-20 10:59 ` Kyrill Tkachov
2015-07-23 20:57 ` Jeff Law
2015-07-24 9:44 ` Kyrill Tkachov
2015-07-24 18:44 ` Jeff Law [this message]
2015-07-27 10:30 ` Kyrill Tkachov
2015-07-27 16:14 ` Jeff Law
2015-07-27 17:54 ` Kyrill Tkachov
2015-07-28 10:21 ` Kyrill Tkachov
2015-07-31 18:08 ` Jeff Law
2015-08-09 21:21 ` Steven Bosscher
2015-08-11 17:05 ` Jeff Law
2015-08-11 17:09 ` Kyrill Tkachov
2015-08-12 14:31 ` Kyrill Tkachov
2015-08-19 12:59 ` Kyrill Tkachov
2015-08-19 16:59 ` Jeff Law
2015-08-19 17:20 ` Kyrill Tkachov
2015-08-19 17:38 ` Jeff Law
2015-09-02 15:18 ` Zamyatin, Igor
2015-09-02 16:02 ` Kyrill Tkachov
2015-09-05 15:22 ` H.J. Lu
2015-09-02 21:01 ` Jeff Law
2015-07-31 17:05 ` Jeff Law
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=55B28737.5040403@redhat.com \
--to=law@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kyrylo.tkachov@arm.com \
--cc=rep.dot.nop@gmail.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).