[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 Uroš Bizjak changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #31 from Uroš Bizjak --- Fixed.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #30 from uros at gcc dot gnu.org --- Author: uros Date: Mon Nov 10 23:29:59 2014 New Revision: 217325 URL: https://gcc.gnu.org/viewcvs?rev=217325&root=gcc&view=rev Log: 2014-11-11 Uros Bizjak Revert: 2014-10-31 Uros Bizjak PR target/63620 * config/i386/i386-protos.h (ix86_use_pseudo_pic_reg): Declare. * config/i386/i386.c (ix86_use_pseudo_pic_reg): Export. * config/i386/i386.md (*pushtf): Allow only CONST_DOUBLEs that won't be reloaded through memory. (*pushxf): Ditto. (*pushdf): Ditto. testsuite/ChangeLog: 2014-11-11 Uros Bizjak Ilya Enkovich PR target/63620 * gcc.target/i386/pr63620.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr63620.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386-protos.h trunk/gcc/config/i386/i386.c trunk/gcc/config/i386/i386.md trunk/gcc/testsuite/ChangeLog
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #29 from Vladimir Makarov --- Author: vmakarov Date: Mon Nov 10 21:33:06 2014 New Revision: 217320 URL: https://gcc.gnu.org/viewcvs?rev=217320&root=gcc&view=rev Log: 2014-11-10 Vladimir Makarov PR rtl-optimization/63620 PR rtl-optimization/63799 * lra-lives.c (process_bb_lives): Do not delete EH_REGION, trapped and setting PIC pseudo insns. (lra_create_live_ranges): Fix the typo. Modified: trunk/gcc/ChangeLog trunk/gcc/lra-lives.c
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #28 from Uroš Bizjak --- (In reply to Vladimir Makarov from comment #27) > Author: vmakarov > Date: Sun Nov 9 16:45:15 2014 > New Revision: 217265 Unfortunately, the patch does not fix the "Reproducer for linux" testcase when the patch from comment 19 is reverted.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #27 from Vladimir Makarov --- Author: vmakarov Date: Sun Nov 9 16:45:15 2014 New Revision: 217265 URL: https://gcc.gnu.org/viewcvs?rev=217265&root=gcc&view=rev Log: 2014-11-09 Vladimir Makarov PR rtl-optimization/63620 * lra-constraints.c (substitute_pseudo): Add prefix lra_ to the name. Move to lra.c. Make it external. (substitute_pseudo_within_insn): Ditto. (inherit_reload_reg, split_reg, remove_inheritance_pseudos): Use the new names. (undo_optional_reloads): Ditto. * lra-int.h (lra_dump_bitmap_with_title, lra_substitute_pseudo): New prototypes. (lra_substitute_pseudo_within_insn): Ditto. * lra-lives.c (bb_killed_pseudos, bb_gen_pseudos): New. (mark_regno_live): Add parameter. Update bb_gen_pseudos. (mark_regno_dead): Add parameter. Update bb_gen_pseudos and bb_killed_pseudos. (struct bb_data, bb_data_t, bb_data): New. (get_bb_data, get_bb_data_by_index): Ditto. (all_hard_regs_bitmap): New. (live_trans_fun, live_con_fun_0, live_con_fun_n, all_blocks): New. (initiate_live_solver, finish_live_solver): New. (process_bb_lives): Change return type. Add code updating local live data and removing dead insns. Pass new argument to mark_regno_live and mark_regno_dead. Check changing bb pseudo life info. Return the result. (lra_create_live_ranges): Add code to do global pseudo live analysis. (lra_live_ranges_init): Call initiate_live_solver. (lra_live_ranges_finish): Call finish_live_solver. * lra.c (lra_dump_bitmap_with_title): New. (lra_substitute_pseudo, lra_substitute_pseudo_within_insn): Move from lra-constraints.c. Modified: trunk/gcc/ChangeLog trunk/gcc/lra-constraints.c trunk/gcc/lra-int.h trunk/gcc/lra-lives.c trunk/gcc/lra.c
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #26 from Uroš Bizjak --- PR 63527 is probably related to this issue.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #25 from uros at gcc dot gnu.org --- Author: uros Date: Fri Oct 31 21:52:22 2014 New Revision: 216990 URL: https://gcc.gnu.org/viewcvs?rev=216990&root=gcc&view=rev Log: PR target/63620 * config/i386/i386-protos.h (ix86_use_pseudo_pic_reg): Declare. * config/i386/i386.c (ix86_use_pseudo_pic_reg): Export. * config/i386/i386.md (*pushtf): Allow only CONST_DOUBLEs that won't be reloaded through memory. (*pushxf): Ditto. (*pushdf): Ditto. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386-protos.h trunk/gcc/config/i386/i386.c trunk/gcc/config/i386/i386.md
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #24 from uros at gcc dot gnu.org --- Author: uros Date: Fri Oct 31 19:47:36 2014 New Revision: 216987 URL: https://gcc.gnu.org/viewcvs?rev=216987&root=gcc&view=rev Log: PR target/63620 * config/i386/i386.md (*pushtf): Allow only CONST_DOUBLES that won't be reloaded through memory. (*pushxf): Ditto. (*pushdf): Ditto. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.md
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #23 from Jeffrey A. Law --- The inline XXX comment approach is fine with me, let's go with that. I'll let you do the honors ;-)
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #22 from Uroš Bizjak --- (In reply to Jeffrey A. Law from comment #21) > Any objection to installing that patch to work around these problems while > Vlad works on things from the rematerialization side? No, I was in fact tempted to commit this patch as a temporary workaround. > > Perhaps put that condition in a function which makes it clear that this is > just a workaround to give Vlad time to build out the real solution? Every condition is slightly different, I think that marking the patterns with a XXX comment, referring to this PR, should be enough.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #21 from Jeffrey A. Law --- Uros, Any objection to installing that patch to work around these problems while Vlad works on things from the rematerialization side? Perhaps put that condition in a function which makes it clear that this is just a workaround to give Vlad time to build out the real solution?
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 Uroš Bizjak changed: What|Removed |Added CC||dominiq at lps dot ens.fr, ||fxcoudert at gcc dot gnu.org, ||mikestump at comcast dot net --- Comment #20 from Uroš Bizjak --- Adding Darwin people to CC.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #19 from Uroš Bizjak --- (In reply to Vladimir Makarov from comment #18) > (In reply to Jeffrey A. Law from comment #17) > > So would it work (and I realize this is a horrid hack) to have a way for the > > backend to set the pic-pseudo as live at the key points during IRA? It'll > > be overly conservative, but it may still be better than going back to a > > fixed PIC register. If we had the conservative live information during IRA, > > presumably it would flow through to LRA and avoid this problem? > > I believe it will disable the optimization completely too. It is up to > Intel guys to decide how to disable the optimization *temporarily* with > minimal efforts most probably only for 2 weeks. Following patch mitigates bootstrap problems: --cut here-- Index: config/i386/i386.md === --- config/i386/i386.md (revision 216952) +++ config/i386/i386.md (working copy) @@ -2736,7 +2736,10 @@ (define_insn "*pushtf" [(set (match_operand:TF 0 "push_operand" "=<,<") (match_operand:TF 1 "general_no_elim_operand" "x,*roF"))] - "TARGET_64BIT || TARGET_SSE" + "(TARGET_64BIT || TARGET_SSE) + && (!can_create_pseudo_p () + || GET_CODE (operands[1]) != CONST_DOUBLE + || standard_sse_constant_p (operands[1]))" { /* This insn should be already split before reg-stack. */ gcc_unreachable (); @@ -2761,7 +2764,9 @@ (define_insn "*pushxf" [(set (match_operand:XF 0 "push_operand" "=<,<") (match_operand:XF 1 "general_no_elim_operand" "f,Yx*roF"))] - "" + "!can_create_pseudo_p () + || GET_CODE (operands[1]) != CONST_DOUBLE + || standard_80387_constant_p (operands[1]) > 0" { /* This insn should be already split before reg-stack. */ gcc_unreachable (); @@ -2792,7 +2797,12 @@ (define_insn "*pushdf" [(set (match_operand:DF 0 "push_operand" "=<,<,<,<") (match_operand:DF 1 "general_no_elim_operand" "f,Yd*roF,rmF,x"))] - "" + "!can_create_pseudo_p () + || GET_CODE (operands[1]) != CONST_DOUBLE + || (!(TARGET_SSE2 && TARGET_SSE_MATH) + && standard_80387_constant_p (operands[1]) > 0) + || (TARGET_SSE2 && TARGET_SSE_MATH + && standard_sse_constant_p (operands[1]))" { /* This insn should be already split before reg-stack. */ gcc_unreachable (); --cut here-- The above patch solves all but corner problems, but generates non-optimal push sequences for constants when general registers are available. So, we can refer to the above hacky patch to "fix" current bootstrap problems. This way it is possible to survive a couple of weeks, until the real fix is available.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #18 from Vladimir Makarov --- (In reply to Jeffrey A. Law from comment #17) > So would it work (and I realize this is a horrid hack) to have a way for the > backend to set the pic-pseudo as live at the key points during IRA? It'll > be overly conservative, but it may still be better than going back to a > fixed PIC register. If we had the conservative live information during IRA, > presumably it would flow through to LRA and avoid this problem? I believe it will disable the optimization completely too. It is up to Intel guys to decide how to disable the optimization *temporarily* with minimal efforts most probably only for 2 weeks.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #17 from Jeffrey A. Law --- So would it work (and I realize this is a horrid hack) to have a way for the backend to set the pic-pseudo as live at the key points during IRA? It'll be overly conservative, but it may still be better than going back to a fixed PIC register. If we had the conservative live information during IRA, presumably it would flow through to LRA and avoid this problem?
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #16 from Vladimir Makarov --- (In reply to Vladimir Makarov from comment #15) > > I am starting to work on this. I have very few time before the end of the > current stage and it makes me reconsider my current work on LRA-remat pass > too. But I guess I can manage. Meanwhile, I guess it is obvious that the pic optimization should be switched off.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 Vladimir Makarov changed: What|Removed |Added CC||vmakarov at gcc dot gnu.org --- Comment #15 from Vladimir Makarov --- (In reply to Jeffrey A. Law from comment #14) > > Which is obviously bogus because %eax is clobbered at insn 13 and thus won't > have a useful value at insn 46. > > Officially assigning to Vlad... I checked the testcase. The problem is in absense of pic pseudo 88 in live in set of BB3 where the constant is put into memory and we need the pseudo to address it. Actually, this is LRA design problem. LRA is not designed for transformations which needs to update global info (live info). That is why it is called local. LRA as older reload pass uses BB-live info got from DF-infrastructure right before its work and never uses DF-infrastructure after that (as reload pass). It can change live info inside BB (reg notes) but never change live info at BB borders (more correctly it can do this in EBB scope used to improve inheritance). The reason for this is that changes in RTL are so massive during LRA/reload that using DF-infrastructure (which has a lot of on-side data and any RTL change results in changing the data) slows down compiler a lot (the very first version of LRA was based on DF and it slowed down the whole compiler by 10%). The problem could have been solved if we used another alternative which does need pic pseudos after the transformation. And my additional patches to this optimization code use this solution (e.g. preventing usage memory equivalence requiring pic addressing or avoiding putting the constant into memory). But it can not work in this case as there are not such acceptable altrenatives. So there are the following solutions of the PR: o marking pic pseudo lives everywhere but it basically rejects all this optimization -- unacceptable o switching to DF-infrastructure. It is a big work and the most important slows down compiler by about 10% -- unacceptable o recalculating global live-info without DF (using only DF data-flow solver) I see the last as the only solution. Such solution would open a door to global LRA transformations. It could help for LRA-remat pass too where I am currently trying to solve some existing performance problems in local scope only. I am starting to work on this. I have very few time before the end of the current stage and it makes me reconsider my current work on LRA-remat pass too. But I guess I can manage.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 Jeffrey A. Law changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |vmakarov at redhat dot com --- Comment #14 from Jeffrey A. Law --- Ilya, thanks for the Linux (well, non-Darwin) testcase. I think it shows very clearly that this is an IRA/LRA problem. If we look at the .ira dump we have: (insn/f 43 7 2 2 (parallel [ (set (reg:SI 88) (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT)) (clobber (reg:CC 17 flags)) ]) 679 {set_got} (expr_list:REG_UNUSED (reg:SI 88) (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_EQUIV (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT) (expr_list:REG_CFA_FLUSH_QUEUE (nil) (nil)) We assign r88 to %eax. Note the REG_UNUSED note. The validity of the REG_UNUSED note is debatable since there aren't any uses of r88 in the RTL, but we do have those "hidden uses" when we have reloads. Later in the .ira dump we have: (call_insn 13 12 14 2 (parallel [ (call (mem:QI (reg/v/f:SI 4 si [orig:87 f ] [87]) [0 *(__float128 (*) (__float128)) f_4(D) S1 A8]) (const_int 32 [0x20])) (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int 4 [0x4]))) ]) j.c:11 657 {*call_pop} (expr_list:REG_CALL_DECL (nil) (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil))) (nil)) [ ... ] (insn 21 18 22 3 (set (mem:TF (pre_dec:SI (reg/f:SI 7 sp)) [1 S16 A128]) (const_double:TF 1.0e+29 [0x0.a18f07d736b90be55p+97])) j.c:13 121 {*pushtf} (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil))) So IRA assigns r88 to %eax. Which makes sense given the raw RTL. As far as IRA can tell, r88 is just set in the SET_GOT insn and it never gets used. LRA turns that into: (insn/f 43 7 2 2 (parallel [ (set (reg:SI 0 ax [88]) (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT)) (clobber (reg:CC 17 flags)) ]) 679 {set_got} (expr_list:REG_EQUIV (unspec:SI [ (const_int 0 [0]) ] UNSPEC_SET_GOT) (expr_list:REG_CFA_FLUSH_QUEUE (nil) (nil [ ... ] (call_insn 13 12 14 2 (parallel [ (call (mem:QI (reg/v/f:SI 4 si [orig:87 f ] [87]) [0 *(__float128 (*) (__float128)) f_4(D) S1 A8]) (const_int 32 [0x20])) (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int 4 [0x4]))) ]) j.c:11 657 {*call_pop} (expr_list:REG_CALL_DECL (nil) (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil))) (nil)) [ ... ] (insn 46 18 47 3 (set (reg:SI 0 ax [93]) (plus:SI (reg:SI 0 ax [88]) (const:SI (unspec:SI [ (symbol_ref/u:SI ("*.LC0") [flags 0x2]) ] UNSPEC_GOTOFF j.c:13 213 {*leasi} (expr_list:REG_EQUAL (symbol_ref/u:SI ("*.LC0") [flags 0x2]) (nil))) (insn 47 46 21 3 (set (reg:TF 23 xmm2 [94]) (mem/u/c:TF (reg:SI 0 ax [93]) [1 S16 A128])) j.c:13 126 {*movtf_internal} (nil)) Which is obviously bogus because %eax is clobbered at insn 13 and thus won't have a useful value at insn 46. Officially assigning to Vlad...
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 Ilya Enkovich changed: What|Removed |Added CC||enkovich.gnu at gmail dot com --- Comment #13 from Ilya Enkovich --- Created attachment 33841 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33841&action=edit Reproducer for Linux
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #12 from Jeffrey A. Law --- The more I watch the %ebx PIC problems, the more this reminds me of secondary reloads and I wonder if we defined those properly if the right things would happen. This kind of thing has shown up on other architectures. For example, on the PA, if you try to load a symbolic constant into an FP register while generating PIC code, you have to generate a secondary reload using %r1 as a scratch. It's not a perfect match in that we don't need a scratch, but instead the PIC register to be live, but it's pretty damn close. I haven't looked at LRA's handling of secondary reloads, but it may be worth someone's time to do so to see if it can be used to show %ebx as being needed in these cases.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #11 from Uroš Bizjak --- (In reply to Stupachenko Evgeny from comment #10) > Anyway, if call is not EBX dependent (say local call in Linux) the issue is > not reproduced (like in example from PR63618). > So the issue looks like Darwin dependent RA issue. True. In Darwin case, RA allocates %eax, which is call-used register and clobbered by the call to f128_p3. I don't see %eax saved around the call. In Linux case, RA allocates %edi, which is call-saved.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #10 from Stupachenko Evgeny --- (In reply to Uroš Bizjak from comment #9) > (In reply to Stupachenko Evgeny from comment #8) > > (In reply to Uroš Bizjak from comment #7) > > > The difference si that the call to f128_p3 does not expand with "use > > > (reg:SI > > > bx)" tag in the Darwin case. Probably ix86_expand_call should be fixed for > > > TARGET_MACHO > > > > Darwin generates indirect access throw generated section: .symbol_stub. > > They don't use EBX in the call even without any changes (relaxing EBX > > usage). > > I guess that the mentioned "use" in the call is what keeps PIC register live > accross push in the non-Darwin case. Not sure I understand Darwin features correct, but they push shifted esp to calls: (objdump of example for PR63618) 0d20 <_f128_square>: d20: 56 push %esi d21: 83 ec 18sub$0x18,%esp d24: 66 0f 6f 44 24 30 movdqa 0x30(%esp),%xmm0 d2a: 89 e0 mov%esp,%eax d2c: 83 ec 2csub$0x2c,%esp d2f: 8b 74 24 4c mov0x4c(%esp),%esi d33: 0f 11 44 24 1c movups %xmm0,0x1c(%esp) d38: 0f 11 44 24 0c movups %xmm0,0xc(%esp) d3d: 50 push %eax d3e: e8 f9 00 00 00 call e3c <___multf3$stub> d43: 89 f0 mov%esi,%eax d45: 66 0f 6f 4c 24 2c movdqa 0x2c(%esp),%xmm1 d4b: 0f 29 0emovaps %xmm1,(%esi) d4e: 83 c4 44add$0x44,%esp d51: 5e pop%esi d52: c2 04 00ret$0x4 Anyway, if call is not EBX dependent (say local call in Linux) the issue is not reproduced (like in example from PR63618). So the issue looks like Darwin dependent RA issue.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #9 from Uroš Bizjak --- (In reply to Stupachenko Evgeny from comment #8) > (In reply to Uroš Bizjak from comment #7) > > The difference si that the call to f128_p3 does not expand with "use (reg:SI > > bx)" tag in the Darwin case. Probably ix86_expand_call should be fixed for > > TARGET_MACHO > > Darwin generates indirect access throw generated section: .symbol_stub. > They don't use EBX in the call even without any changes (relaxing EBX usage). I guess that the mentioned "use" in the call is what keeps PIC register live accross push in the non-Darwin case.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #8 from Stupachenko Evgeny --- (In reply to Uroš Bizjak from comment #7) > The difference si that the call to f128_p3 does not expand with "use (reg:SI > bx)" tag in the Darwin case. Probably ix86_expand_call should be fixed for > TARGET_MACHO Darwin generates indirect access throw generated section: .symbol_stub. They don't use EBX in the call even without any changes (relaxing EBX usage). > > However, even if this will solve bootstrap, the RA should be fixed to mark > PIC register live in case when constant is moved to memory.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #7 from Uroš Bizjak --- The difference si that the call to f128_p3 does not expand with "use (reg:SI bx)" tag in the Darwin case. Probably ix86_expand_call should be fixed for TARGET_MACHO. However, even if this will solve bootstrap, the RA should be fixed to mark PIC register live in case when constant is moved to memory.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #6 from Uroš Bizjak --- (In reply to Igor Zamyatin from comment #5) > > Confirmed. This will affect all SSE targets. > > Have you managed to reproduce the issue on i686? No, only with a crosscompiler to x86_64-apple-darwin11. The i686-linux looks OK.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 Igor Zamyatin changed: What|Removed |Added CC||izamyatin at gmail dot com --- Comment #5 from Igor Zamyatin --- (In reply to Uroš Bizjak from comment #3) > Confirmed. This will affect all SSE targets. Have you managed to reproduce the issue on i686? > The patch at Comment #2 will just paper over the issue. Yeah, it was just a temporary fix for Darwin folks
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #4 from Uroš Bizjak --- Please note that: (define_insn "*pushtf" [(set (match_operand:TF 0 "push_operand" "=<,<") (match_operand:TF 1 "general_no_elim_operand" "x,*roF"))] "TARGET_64BIT || TARGET_SSE" { /* This insn should be already split before reg-stack. */ gcc_unreachable (); } [(set_attr "isa" "*,x64") (set_attr "type" "multi") (set_attr "unit" "sse,*") (set_attr "mode" "TF,DI")]) in effect looks like: (define_insn "*pushtf" [(set (match_operand:TF 0 "push_operand" "=<") (match_operand:TF 1 "general_no_elim_operand" "x"))] on 32bit x86, due to "isa" attribute.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 Uroš Bizjak changed: What|Removed |Added Keywords||ra Target|Darwin |x86 Status|UNCONFIRMED |NEW Last reconfirmed||2014-10-26 Target Milestone|--- |5.0 Ever confirmed|0 |1 --- Comment #3 from Uroš Bizjak --- Confirmed. This will affect all SSE targets. This is an RA issue. When RA kicks the constant to a memory, PIC register should be marked as live for the insn that accesses memory. We start with: (insn 21 17 22 3 (set (mem:TF (pre_dec:SI (reg/f:SI 7 sp)) [1 S16 A128]) (const_double:TF 1.0e+29 [0x0.a18f07d736b90be55p+97])) pr63620.c:21 121 {*pushtf} (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil))) and RA does: Choosing alt 0 in insn 21: (0) =< (1) x {*pushtf} Creating newreg=93, assigning class GENERAL_REGS to addr r93 Change to class INDEX_REGS for r93 Creating newreg=94, assigning class SSE_REGS to r94 21: [--sp:SI]=r94:TF REG_ARGS_SIZE 0x10 Inserting insn reload before: 46: r93:SI=r87:SI+const(unspec[`*LC0'] 10) REG_EQUAL `*LC0' 47: r94:TF=[r93:SI] which results in: (insn 46 17 47 3 (set (reg:SI 0 ax [93]) (plus:SI (reg:SI 0 ax [87]) (const:SI (unspec:SI [ (symbol_ref/u:SI ("*LC0") [flags 0x2]) ] UNSPEC_MACHOPIC_OFFSET pr63620.c:21 213 {*leasi} (expr_list:REG_EQUAL (symbol_ref/u:SI ("*LC0") [flags 0x2]) (nil))) (insn 47 46 21 3 (set (reg:TF 23 xmm2 [94]) (mem/u/c:TF (reg:SI 0 ax [93]) [1 S16 A128])) pr63620.c:21 126 {*movtf_internal} (nil)) (insn 21 47 22 3 (set (mem:TF (pre_dec:SI (reg/f:SI 7 sp)) [1 S16 A128]) (reg:TF 23 xmm2 [94])) pr63620.c:21 121 {*pushtf} (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil))) When the constant is pushed to a memory to satisfy operand constraints, the PIC register should be marked as live (== used by the insn that reads memory). RA even sets the REG_EQUAL to a symbol_ref in the reloading insn. The patch at Comment #2 will just paper over the issue.
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #2 from Stupachenko Evgeny --- Created attachment 33784 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33784&action=edit patch making the test and darwin bootstrap pass
[Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620 --- Comment #1 from Stupachenko Evgeny --- The issue reproduced only if patch from PR63618 is applied.