diff mbox

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

Message ID CAFULd4asydptQzyOuyLWe673vxWN5oxUOU-3qpqFZayZ0Hj7Xw@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 13, 2012, 5:07 p.m. UTC
On Mon, Nov 12, 2012 at 9:40 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> 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.

Committed to mailine SVN with additional restriction, we only want to
scan instructions that are not debug instructions.

2012-11-13  Uros Bizjak  <ubizjak@gmail.com>

	PR target/41993
	* mode-switching.c (create_pre_exit): Set return_copy to last_insn if
	copy_start is not a function return regno. Skip debug instructions
	in instruction scan loop.

Bootstrapped and regression tested on SH4 by Kaz and Oleg, on AVX
target by Vladimir and by me on x86_64-pc-linux-gnu {,-m32 -} AVX
target, configured with "--with-arch=corei7-avx --with-cpu=corei7-avx
--enable-languages=all,obj-c++,go" with and without postreload
vzeroupper insertion patch.

Uros.

Comments

Jakub Jelinek Nov. 13, 2012, 5:09 p.m. UTC | #1
On Tue, Nov 13, 2012 at 06:07:20PM +0100, Uros Bizjak wrote:
> @@ -242,7 +242,8 @@ create_pre_exit (int n_entities, int *entity_map,
>  		int copy_start, copy_num;
>  		int j;
>  
> -		if (INSN_P (return_copy))
> +		if (INSN_P (return_copy)
> +		    && !DEBUG_INSN_P (return_copy))

Please use if (NONDEBUG_INSN_P (return_copy)) instead.

	Jakub
Uros Bizjak Nov. 13, 2012, 5:13 p.m. UTC | #2
On Tue, Nov 13, 2012 at 6:09 PM, Jakub Jelinek <jakub@redhat.com> wrote:

>>               int copy_start, copy_num;
>>               int j;
>>
>> -             if (INSN_P (return_copy))
>> +             if (INSN_P (return_copy)
>> +                 && !DEBUG_INSN_P (return_copy))
>
> Please use if (NONDEBUG_INSN_P (return_copy)) instead.

Bah... I did look at this definition and for some reason unknown to
me, I didn't see the equivalence. Anyway, I have committed the change.

Thanks,
Uros.
diff mbox

Patch

Index: mode-switching.c
===================================================================
--- mode-switching.c	(revision 193479)
+++ mode-switching.c	(working copy)
@@ -242,7 +242,8 @@  create_pre_exit (int n_entities, int *entity_map,
 		int copy_start, copy_num;
 		int j;
 
-		if (INSN_P (return_copy))
+		if (INSN_P (return_copy)
+		    && !DEBUG_INSN_P (return_copy))
 		  {
 		    /* When using SJLJ exceptions, the call to the
 		       unregister function is inserted between the
@@ -330,7 +331,7 @@  create_pre_exit (int n_entities, int *entity_map,
 			  short_block = 1;
 			break;
 		      }
-		    if (copy_start >= FIRST_PSEUDO_REGISTER)
+		    if (!targetm.calls.function_value_regno_p (copy_start))
 		      {
 			last_insn = return_copy;
 			continue;