From: Vladimir Makarov <vmakarov@redhat.com>
To: SenthilKumar.Selvaraj@microchip.com, gcc-patches@gcc.gnu.org
Subject: Re: [IRA] Skip empty register classes in setup_reg_class_relations
Date: Thu, 13 Jul 2023 08:45:59 -0400 [thread overview]
Message-ID: <853bd9a6-1e19-0a80-9b4a-49761123630c@redhat.com> (raw)
In-Reply-To: <4c71614eec51bbefe18602f3fb6301efcf33f477.camel@microchip.com>
On 7/12/23 07:05, SenthilKumar.Selvaraj@microchip.com wrote:
> Hi,
>
> I've been spending some (spare) time trying to get LRA working
> for the avr target.
Thank you for addressing this problem.
The code you changing is very sensitive and was a source of multiple PRs
in the past. But I found the change your propose logical and I think it
will not create problems. Still please be alert and revert the patch if
people reports the problem with this change.
> After making a couple of changes to get
> libgcc going, I'm now hitting an assert at
> lra-constraints.cc:4423 for a subarch (avrtiny) that has a
> couple of regclasses with no available registers.
>
> The assert fires because in_class_p (correctly) returns
> false for get_reg_class (regno) = ALL_REGS, and new_class =
> NO_LD_REGS. For avrtiny, NO_LD_REGS is an empty regset, and
> therefore hard_reg_set_subset_p (NO_LD_REGS, lra_no_alloc_regs)
> is always true, making in_class_p return false.
>
> in_class_p picks NO_LD_REGS as new_class because common_class =
> ira_reg_class_subset[ALL_REGS][NO_REGS] evaluates as
> NO_LD_REGS. This appears wrong to me - it should be NO_REGS
> instead (lra-constraints.cc:4421 checks for NO_REGS).
>
> ira.cc:setup_reg_class_relations sets up
> ira_reg_class_subset (among other things), and the problem
> appears to be a missing continue statement if
> reg_class_contents[cl3] (in the innermost loop) is empty.
>
> In this case, for cl1 = ALL_REGS and cl2 = NO_REGS, cl3 =
> NO_LD_REGS, temp_hard_regset and temp_set2 are both empty, and
> hard_reg_subset_p (<emptyset>, <anyval>) is always true, so
> ira_reg_class_subset[ALL_REGS][NO_REGS] ends up being set to
> cl3 = NO_LD_REGS. Adding a continue if hard_reg_set_empty_p (temp_hard_regset)
> fixes the problem for me.
>
> Does the below patch look ok? Bootstrapping and regression
> testing passed on x86_64.
OK.
prev parent reply other threads:[~2023-07-13 12:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 11:05 SenthilKumar.Selvaraj
2023-07-13 12:45 ` Vladimir Makarov [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=853bd9a6-1e19-0a80-9b4a-49761123630c@redhat.com \
--to=vmakarov@redhat.com \
--cc=SenthilKumar.Selvaraj@microchip.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).