public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Possible dead code in file lra-spills.cc
  2022-12-17  9:25 Possible dead code in file lra-spills.cc G.T.
@ 2022-12-14 18:46 ` Richard Biener
  2022-12-15 15:21   ` G.T.
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2022-12-14 18:46 UTC (permalink / raw)
  To: G.T.; +Cc: gcc



> Am 14.12.2022 um 18:28 schrieb G.T. via Gcc <gcc@gcc.gnu.org>:
> 
> At line 276, lra_assert (spill_class != NO_REGS); would trigger
> whenever execution reached here with spill_class equal to NO_REGS.
> Seems to me that would never happen. Because one of the conditions in
> the if statement right above it (line 265) catches spill_class ==
> NO_REGS and causes the rest of the for loop to be skipped by executing
> continue in the consequent of the if. So lra_assert never sees
> spill_class == NO_REGS. That makes line 276 dead code, right?

Sometimes this serves as documentation to make the code more obvious to read.  Depends on the distance of the redundant check.

Richard 


> Thanks.
> GT.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Possible dead code in file lra-spills.cc
  2022-12-14 18:46 ` Richard Biener
@ 2022-12-15 15:21   ` G.T.
  0 siblings, 0 replies; 3+ messages in thread
From: G.T. @ 2022-12-15 15:21 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 937 bytes --]

Ok.

And as you point out it is redundant code rather than dead code, to be
precise.

On Wed, Dec 14, 2022, 1:47 PM Richard Biener <richard.guenther@gmail.com>
wrote:

>
>
> > Am 14.12.2022 um 18:28 schrieb G.T. via Gcc <gcc@gcc.gnu.org>:
> >
> > At line 276, lra_assert (spill_class != NO_REGS); would trigger
> > whenever execution reached here with spill_class equal to NO_REGS.
> > Seems to me that would never happen. Because one of the conditions in
> > the if statement right above it (line 265) catches spill_class ==
> > NO_REGS and causes the rest of the for loop to be skipped by executing
> > continue in the consequent of the if. So lra_assert never sees
> > spill_class == NO_REGS. That makes line 276 dead code, right?
>
> Sometimes this serves as documentation to make the code more obvious to
> read.  Depends on the distance of the redundant check.
>
> Richard
>
>
> > Thanks.
> > GT.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Possible dead code in file lra-spills.cc
@ 2022-12-17  9:25 G.T.
  2022-12-14 18:46 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: G.T. @ 2022-12-17  9:25 UTC (permalink / raw)
  To: gcc

At line 276, lra_assert (spill_class != NO_REGS); would trigger
whenever execution reached here with spill_class equal to NO_REGS.
Seems to me that would never happen. Because one of the conditions in
the if statement right above it (line 265) catches spill_class ==
NO_REGS and causes the rest of the for loop to be skipped by executing
continue in the consequent of the if. So lra_assert never sees
spill_class == NO_REGS. That makes line 276 dead code, right?

Thanks.
GT.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-15 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17  9:25 Possible dead code in file lra-spills.cc G.T.
2022-12-14 18:46 ` Richard Biener
2022-12-15 15:21   ` G.T.

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).