From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [RFA] Avoid unnecessary load-immediate in coremark
Date: Sat, 1 Oct 2022 13:03:14 -0600 [thread overview]
Message-ID: <a9792ae0-86a2-9790-f453-dcaa24e0fe6b@gmail.com> (raw)
In-Reply-To: <mptczbdp29o.fsf@arm.com>
On 9/30/22 04:47, Richard Sandiford wrote:
> Jeff Law <jlaw@ventanamicro.com> writes:
>> This is another minor improvement to coremark. I suspect this only
>> improves code size as the load-immediate was likely issuing with the ret
>> statement on multi-issue machines.
>>
>>
>> Basically we're failing to utilize conditional equivalences during the
>> post-reload CSE pass. So if a particular block is only reached when a
>> certain condition holds (say for example a4 == 0) and the block has an
>> assignment like a4 = 0, we would fail to eliminate the unnecessary
>> assignment.
> I wasn't sure (and was too lazy to try, sorry), but: is the reason
> that we fail to catch this earlier because the two uses of r4 are
> entirely separate (i.e. not from the same pseudo)?
Right. Different pseudos used in the comparison vs the destination of
the assignment. If they used the same pseudo, then I would have
expected cse or gcse to pick it up.
>
>> + /* Iterate over each incoming edge and see if they
>> + all have the same implicit set. */
>> + FOR_EACH_EDGE (e, ei, bb->preds)
>> + {
>> + /* If the predecessor does not end in a conditional
>> + jump, then it does not have an implicit set. */
>> + if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun)
>> + && !block_ends_with_condjump_p (e->src))
>> + {
>> + found = false;
>> + break;
>> + }
>> +
>> + /* We know the predecessor ends with a conditional
>> + jump. Now dig into the actal form of the jump
>> + to potentially extract an implicit set. */
> Very minor, but it looked odd to fall through for the entry block.
> How about:
>
> if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun)
> || !block_ends_with_condjump_p (e->src))
>
> ?
Looks like a mistake to me. we don't want to process anything for a
successor of the entry block. I'll adjust and retest.
Thanks,
Jeff
prev parent reply other threads:[~2022-10-01 19:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 19:53 Jeff Law
2022-09-29 7:44 ` Richard Biener
2022-10-01 18:58 ` Jeff Law
2022-09-30 10:47 ` Richard Sandiford
2022-10-01 19:03 ` Jeff Law [this message]
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=a9792ae0-86a2-9790-f453-dcaa24e0fe6b@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/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).