Patchwork [x86/darwin] fix PR51784 'PIC register not correctly preserved...'

login
register
mail settings
Submitter Uros Bizjak
Date July 21, 2013, 7:34 a.m.
Message ID <CAFULd4agWAgfk_-ey_mYgHYYMYY2-KsfAjxC0y2A_xSoute_sQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/260496/
State New
Headers show

Comments

Uros Bizjak - July 21, 2013, 7:34 a.m.
On Fri, Jul 19, 2013 at 11:00 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Jul 19, 2013 at 04:56:47PM +0200, Uros Bizjak wrote:
>> > OK for trunk?
>>
>> Assuming that Jakub is OK with the patch, it is OK for trunk.
>
> With the line wrapping fix and Uros' suggested improvement this is ok for
> both trunk and branches.

Can you please also consider attached patch? There is no need to drag
around an UNSPEC if we don't need it anymore. Attached patch marks
instruction as deleted in this case.

The patch was tested by looking at the generated code from various
testcases in the PR.

Uros.
Iain Sandoe - July 21, 2013, 7:42 a.m.
Hi Uros,

On 21 Jul 2013, at 08:34, Uros Bizjak wrote:

> <p.diff.txt>

Sure, I can test that - do you want me to apply it assuming it reg-tests OK on darwin & linux?
(also I can amend the back ports - since I didn't have time to get to them yesterday)

thanks
Iain
Uros Bizjak - July 21, 2013, 8:15 a.m.
On Sun, Jul 21, 2013 at 9:42 AM, Iain Sandoe <iain@codesourcery.com> wrote:

>> <p.diff.txt>
>
> Sure, I can test that - do you want me to apply it assuming it reg-tests OK on darwin & linux?
> (also I can amend the back ports - since I didn't have time to get to them yesterday)

Yes, please test it on darwin. The build test on linux went OK.
However, the change is not effective on linux, so I have no means to
properly test it by myself.

If everything is OK, please also use this change in backports.

The ChangeLog is attached below.

2013-07-21  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.md (nonlocal_goto_receiver): Delete insn if
    it is not needed after split.

Thanks,
Uros.
Iain Sandoe - July 22, 2013, 9:25 a.m.
Hi Uros,

On 21 Jul 2013, at 09:15, Uros Bizjak wrote:

> On Sun, Jul 21, 2013 at 9:42 AM, Iain Sandoe <iain@codesourcery.com> wrote:
> 
>>> <p.diff.txt>
>> 
>> Sure, I can test that - do you want me to apply it assuming it reg-tests OK on darwin & linux?
>> (also I can amend the back ports - since I didn't have time to get to them yesterday)
> 
> Yes, please test it on darwin. The build test on linux went OK.
> However, the change is not effective on linux, so I have no means to
> properly test it by myself.
> 
> If everything is OK, please also use this change in backports.

Thanks, that checked out fine, so I've applied it to mainline and the combined version to 4.8.
I'm travelling this week with limited access to my Darwin boxen, so the 4.7 version might be a bit delayed - similarly, I might take more time than usual to respond to emails.
thanks,
Iain

Patch

Index: i386.md
===================================================================
--- i386.md	(revision 201091)
+++ i386.md	(working copy)
@@ -16233,12 +16233,7 @@ 
 (define_insn_and_split "nonlocal_goto_receiver"
   [(unspec_volatile [(const_int 0)] UNSPECV_NLGR)]
   "TARGET_MACHO && !TARGET_64BIT && flag_pic"
-{
-  if (crtl->uses_pic_offset_table)
-    return "#";
-  else
-    return ""; /* No pic reg restore needed.  */
-}
+  "#"
   "&& reload_completed"
   [(const_int 0)]
 {
@@ -16258,6 +16253,10 @@ 
       xops[2] = gen_rtx_CONST (Pmode, tmp);
       ix86_expand_binary_operator (MINUS, SImode, xops);
     }
+  else
+     /* No pic reg restore needed.  */
+    emit_note (NOTE_INSN_DELETED);
+
   DONE;
 })