public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix recent bug in canonicalize_comparison (PR87026)
@ 2018-08-23 12:05 Segher Boessenkool
  2018-08-23 12:11 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Segher Boessenkool @ 2018-08-23 12:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool

The new code testing which way a comparison is best expressed creates
a pseudoregister (by hand) and creates some insns with that.  Such
insns will no longer recog() when pseudo-registers are no longer
aloowed (after reload).  But we have an ifcvt pass after reload (ce3).

This patch simply returns if we cannot create pseudos.

Tested on powerpc64-linux {-m32,-m64}.  Is this okay for trunk?


Segher


2018-08-23  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/87026
	* expmed.c (canonicalize_comparison): If we can no longer create
	pseudoregisters, don't.

---
 gcc/expmed.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/expmed.c b/gcc/expmed.c
index e281930..0922029 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -6243,6 +6243,10 @@ canonicalize_comparison (machine_mode mode, enum rtx_code *code, rtx *imm)
   if (overflow)
     return;
 
+  /* The following creates a pseudo; if we cannot do that, bail out.  */
+  if (!can_create_pseudo_p ())
+    return;
+
   rtx reg = gen_rtx_REG (mode, LAST_VIRTUAL_REGISTER + 1);
   rtx new_imm = immed_wide_int_const (imm_modif, mode);
 
-- 
1.8.3.1

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

* Re: [PATCH] Fix recent bug in canonicalize_comparison (PR87026)
  2018-08-23 12:05 [PATCH] Fix recent bug in canonicalize_comparison (PR87026) Segher Boessenkool
@ 2018-08-23 12:11 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-08-23 12:11 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: GCC Patches

On Thu, Aug 23, 2018 at 2:05 PM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> The new code testing which way a comparison is best expressed creates
> a pseudoregister (by hand) and creates some insns with that.  Such
> insns will no longer recog() when pseudo-registers are no longer
> aloowed (after reload).  But we have an ifcvt pass after reload (ce3).
>
> This patch simply returns if we cannot create pseudos.
>
> Tested on powerpc64-linux {-m32,-m64}.  Is this okay for trunk?

OK.

>
> Segher
>
>
> 2018-08-23  Segher Boessenkool  <segher@kernel.crashing.org>
>
>         PR rtl-optimization/87026
>         * expmed.c (canonicalize_comparison): If we can no longer create
>         pseudoregisters, don't.
>
> ---
>  gcc/expmed.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/gcc/expmed.c b/gcc/expmed.c
> index e281930..0922029 100644
> --- a/gcc/expmed.c
> +++ b/gcc/expmed.c
> @@ -6243,6 +6243,10 @@ canonicalize_comparison (machine_mode mode, enum rtx_code *code, rtx *imm)
>    if (overflow)
>      return;
>
> +  /* The following creates a pseudo; if we cannot do that, bail out.  */
> +  if (!can_create_pseudo_p ())
> +    return;
> +
>    rtx reg = gen_rtx_REG (mode, LAST_VIRTUAL_REGISTER + 1);
>    rtx new_imm = immed_wide_int_const (imm_modif, mode);
>
> --
> 1.8.3.1
>

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

end of thread, other threads:[~2018-08-23 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 12:05 [PATCH] Fix recent bug in canonicalize_comparison (PR87026) Segher Boessenkool
2018-08-23 12:11 ` 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).