[RFA,middle-end] Fix PR target/41993

Submitted by Uros Bizjak on Nov. 12, 2012, 8:36 a.m.

Details

Message ID CAFULd4bNJounwyhgT3DgAJzPZ_iH-yZG-Z-rbRoJytD4M0UJJQ@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 12, 2012, 8:36 a.m.
On Tue, Nov 6, 2012 at 9:12 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> 2012-11-05  Uros Bizjak  <ubizjak@gmail.com>
>>           Kaz Kojima  <kkojima@gcc.gnu.org>
>>
>>       PR target/41993
>>       * mode-switching.c (create_pre_exit): Set return_copy to
>>       last_insn when copy_start is a pseudo reg.

It looks to me, that we in fact want:

--cut here--
--cut here--

If we find an unrelated HARD register, we will fail in the same way as
described in the PR. This was found by post-reload vzeroupper
insertion pass that tripped on unrelated hard reg assignment. At this
point, we are interested only in hard registers that are also used for
function return value. Actually, even in pre-reload pass, there are no
other assignments to hard registers.

Uros.

Comments

Eric Botcazou Nov. 12, 2012, 8:40 a.m.
> It looks to me, that we in fact want:
> 
> --cut here--
> Index: mode-switching.c
> ===================================================================
> --- mode-switching.c    (revision 193407)
> +++ mode-switching.c    (working copy)
> @@ -330,7 +330,7 @@
>                           short_block = 1;
>                         break;
>                       }
> -                   if (copy_start >= FIRST_PSEUDO_REGISTER)
> +                   if (!targetm.calls.function_value_regno_p (copy_start))
>                       {
>                         last_insn = return_copy;
>                         continue;
> --cut here--
> 
> If we find an unrelated HARD register, we will fail in the same way as
> described in the PR. This was found by post-reload vzeroupper
> insertion pass that tripped on unrelated hard reg assignment. At this
> point, we are interested only in hard registers that are also used for
> function return value. Actually, even in pre-reload pass, there are no
> other assignments to hard registers.

Fine with me if this passes testing on x86-avx and SH4.

Patch hide | download patch | download mbox

Index: mode-switching.c
===================================================================
--- mode-switching.c    (revision 193407)
+++ mode-switching.c    (working copy)
@@ -330,7 +330,7 @@ 
                          short_block = 1;
                        break;
                      }
-                   if (copy_start >= FIRST_PSEUDO_REGISTER)
+                   if (!targetm.calls.function_value_regno_p (copy_start))
                      {
                        last_insn = return_copy;
                        continue;