public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] cfgrtl: Fix up -g vs. -g0 code generation -flto differences in fixup_reorder_chain [PR104589]
@ 2022-03-02  9:35 Jakub Jelinek
  2022-03-02  9:44 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2022-03-02  9:35 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

This is similar to PR104237 and similarly to that, no testcase included
for the testsuite, as we don't have a framework to compile/link with
-g -flto and -g0 -flto and compare -fdump-final-insns= results from
the lto1 compilations.

With -flto, whether two location_t compare equal or not and just
express the same location is a lottery.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2022-03-02  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/104589
	* cfgrtl.cc (fixup_reorder_chain): Use loc_equal instead of direct
	INSN_LOCATION comparison with goto_locus.

--- gcc/cfgrtl.cc.jj	2022-02-04 14:36:54.068618386 +0100
+++ gcc/cfgrtl.cc	2022-03-01 16:11:06.307419636 +0100
@@ -4090,7 +4090,7 @@ fixup_reorder_chain (void)
 		     && (!NONDEBUG_INSN_P (insn) || !INSN_HAS_LOCATION (insn)))
 		insn = PREV_INSN (insn);
 	      if (insn != end
-		  && INSN_LOCATION (insn) == e->goto_locus)
+		  && loc_equal (INSN_LOCATION (insn), e->goto_locus))
 		continue;
 	      if (simplejump_p (BB_END (e->src))
 		  && !INSN_HAS_LOCATION (BB_END (e->src)))
@@ -4112,7 +4112,7 @@ fixup_reorder_chain (void)
 		  while (insn != end && !NONDEBUG_INSN_P (insn))
 		    insn = NEXT_INSN (insn);
 		  if (insn != end && INSN_HAS_LOCATION (insn)
-		      && INSN_LOCATION (insn) == e->goto_locus)
+		      && loc_equal (INSN_LOCATION (insn), e->goto_locus))
 		    continue;
 		}
 	      nb = split_edge (e);

	Jakub


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

* Re: [PATCH] cfgrtl: Fix up -g vs. -g0 code generation -flto differences in fixup_reorder_chain [PR104589]
  2022-03-02  9:35 [PATCH] cfgrtl: Fix up -g vs. -g0 code generation -flto differences in fixup_reorder_chain [PR104589] Jakub Jelinek
@ 2022-03-02  9:44 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-03-02  9:44 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 2 Mar 2022, Jakub Jelinek wrote:

> Hi!
> 
> This is similar to PR104237 and similarly to that, no testcase included
> for the testsuite, as we don't have a framework to compile/link with
> -g -flto and -g0 -flto and compare -fdump-final-insns= results from
> the lto1 compilations.
> 
> With -flto, whether two location_t compare equal or not and just
> express the same location is a lottery.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?

OK.

Richard.

> 2022-03-02  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR rtl-optimization/104589
> 	* cfgrtl.cc (fixup_reorder_chain): Use loc_equal instead of direct
> 	INSN_LOCATION comparison with goto_locus.
> 
> --- gcc/cfgrtl.cc.jj	2022-02-04 14:36:54.068618386 +0100
> +++ gcc/cfgrtl.cc	2022-03-01 16:11:06.307419636 +0100
> @@ -4090,7 +4090,7 @@ fixup_reorder_chain (void)
>  		     && (!NONDEBUG_INSN_P (insn) || !INSN_HAS_LOCATION (insn)))
>  		insn = PREV_INSN (insn);
>  	      if (insn != end
> -		  && INSN_LOCATION (insn) == e->goto_locus)
> +		  && loc_equal (INSN_LOCATION (insn), e->goto_locus))
>  		continue;
>  	      if (simplejump_p (BB_END (e->src))
>  		  && !INSN_HAS_LOCATION (BB_END (e->src)))
> @@ -4112,7 +4112,7 @@ fixup_reorder_chain (void)
>  		  while (insn != end && !NONDEBUG_INSN_P (insn))
>  		    insn = NEXT_INSN (insn);
>  		  if (insn != end && INSN_HAS_LOCATION (insn)
> -		      && INSN_LOCATION (insn) == e->goto_locus)
> +		      && loc_equal (INSN_LOCATION (insn), e->goto_locus))
>  		    continue;
>  		}
>  	      nb = split_edge (e);
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Ivo Totev; HRB 36809 (AG Nuernberg)

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

end of thread, other threads:[~2022-03-02  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02  9:35 [PATCH] cfgrtl: Fix up -g vs. -g0 code generation -flto differences in fixup_reorder_chain [PR104589] Jakub Jelinek
2022-03-02  9:44 ` Richard Biener

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