[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 Martin Liška changed: What|Removed |Added CC||marxin at gcc dot gnu.org --- Comment #15 from Martin Liška --- Vladimir: Can you please update Known to work?
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 Andreas Krebbel changed: What|Removed |Added Status|RESOLVED|REOPENED Last reconfirmed||2018-07-25 Version|8.0 |7.3.1 Resolution|FIXED |--- Ever confirmed|0 |1 --- Comment #14 from Andreas Krebbel --- I ran into the same problem with current GCC 7 branch. Could you apply your fix also to GCC 7 branch?
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 Jeffrey A. Law changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC||law at redhat dot com Resolution|--- |FIXED --- Comment #13 from Jeffrey A. Law --- Fixed by Vlad commit on the trunk.
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #12 from Vladimir Makarov --- Author: vmakarov Date: Thu Dec 7 17:50:54 2017 New Revision: 255471 URL: https://gcc.gnu.org/viewcvs?rev=255471=gcc=rev Log: 2017-12-07 Vladimir MakarovPR target/83252 PR rtl-optimization/80818 * lra.c (add_regs_to_insn_regno_info): Make a hard reg in CLOBBER always early clobbered. * lra-lives.c (process_bb_lives): Check input hard regs for early clobbered non-operand hard reg. Modified: trunk/gcc/ChangeLog trunk/gcc/lra-lives.c trunk/gcc/lra.c
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #11 from Vladimir Makarov --- I am still working on this PR. I hope to fix it on this week or on the next one (the patch will need a lot of testing).
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #10 from Vladimir Makarov --- Author: vmakarov Date: Wed Nov 29 22:19:25 2017 New Revision: 255258 URL: https://gcc.gnu.org/viewcvs?rev=255258=gcc=rev Log: 2017-11-29 Vladimir MakarovPR rtl-optimization/80818 * lra.c (collect_non_operand_hard_regs): New arg insn. Pass it recursively. Use insn code for clobber. (lra_set_insn_recog_data): Pass the new arg to collect_non_operand_hard_regs. (add_regs_to_insn_regno_info): Pass insn instead of uid. Use insn code for clobber. (lra_update_insn_regno_info): Pass insn to add_regs_to_insn_regno_info. Modified: trunk/gcc/ChangeLog trunk/gcc/lra.c
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #9 from Vladimir Makarov --- (In reply to Andreas Krebbel from comment #8) > Hi Vladimir. What do you think about the additional patch? Andreas, sorry for the delay with the answer. The patch looks reasonable for me. If your additional patch works for you we could try to incorporate it into my patch. I'll do it and test the new patch and, if everything is ok, I'll commit it tomorrow or on Wednesday.
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 Andreas Krebbel changed: What|Removed |Added Priority|P3 |P2 --- Comment #8 from Andreas Krebbel --- Hi Vladimir. What do you think about the additional patch?
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #7 from Andreas Krebbel --- Created attachment 41699 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41699=edit Additional changes required ontop of the proposed patch Changes which might be required on-top of your patch. Your patch alone does not appear to fix the testcase for me. Neither the reduced nor the full version. The hard reg clobber is added in collect_non_operand_hard_regs not in add_regs_to_insn_regno_info. Copying what your patch does in add_regs_to_insn_regno_info to collect_non_operand_hard_regs does fix the problem for me.
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #6 from Vladimir Makarov --- Hi, Andreas. Could you check the patch I attached on your bigger test case. If it works, I will commit it.
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #5 from Vladimir Makarov --- Created attachment 41686 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41686=edit A proposed patch
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #4 from Andreas Krebbel --- Created attachment 41609 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41609=edit Reduced testcase gcc -O3 -march=z900 t.c r33 is marked as unused in process_bb_lives for the compare (insn 10), although the value is used by the add with carry (insn 18). (insn 10 23 24 2 (parallel [ (set (reg:CCL3 33 %cc) (compare:CCL3 (reg/v:DI 73 [orig:64 a ] [64]) (reg/v:DI 65 [ b ]))) (clobber (reg/v:DI 73 [orig:64 a ] [64])) ]) "t.c":6 1632 {*subdi3_cconly2} (expr_list:REG_UNUSED (reg:CC 33 %cc) (expr_list:REG_UNUSED (reg/v:DI 73 [orig:64 a ] [64]) (expr_list:REG_DEAD (reg/v:DI 65 [ b ]) (nil)
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #3 from Vladimir Makarov --- (In reply to Andreas Krebbel from comment #0) > Created attachment 41383 [details] > Experimental patch Andreas, thank you for working on the issue. You are right. The hard reg in the clobber should be not be an earlyclobber one. But, unfortunately the patch is not fully correct. Static data exists in one examplar for insn with the same insn code and as consequence should not be dependent on other operands. I'll think about the correct solution. Do you have a test case? The patch might be ready soon after I get the test. Although it will take some time to test the patch.
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 --- Comment #2 from Andreas Krebbel --- I think this is a different problem. In my case the reason for adding an invalid rematerialization appears to be that the live ranges of an hard registers are not correctly calculated. I've just verified with GCC head r249394: For the two insns: (insn 470 25077 476 10 (set (reg:CCU 33 %cc) (compare:CCU (reg:DI 3 %r3 [orig:1277 _1997 ] [1277]) (mem/u/c:DI (reg:DI 5 %r5 [14737]) [5 S8 A64]))) "t.f90":48 1242 {*cmpdi_ccu} (nil)) (insn 472 27815 25079 10 (parallel [ (set (reg:SI 7 %r7 [orig:1282 _2003 ] [1282]) (plus:SI (plus:SI (gtu:SI (reg:CCU 33 %cc) (const_int 0 [0])) (reg:SI 7 %r7 [orig:1256 _1967 ] [1256])) (reg:SI 2 %r2 [orig:1258 _1969 ] [1258]))) (clobber (reg:CC 33 %cc)) ]) "t.f90":48 1661 {*addsi3_alc} (nil)) LRA records the following registers: 470: {early_clobber_alts = 0, biggest_mode = DImode, type = OP_IN, subreg_p = 0, early_clobber = 0, regno = 1277, next = 0x3cdb480} {early_clobber_alts = 0, biggest_mode = DImode, type = OP_IN, subreg_p = 0, early_clobber = 0, regno = 14737, next = 0x0} hardregs: {early_clobber_alts = 0, biggest_mode = CCUmode, type = OP_OUT, subreg_p = 0, early_clobber = 0, regno = 33, next = 0x0} 472: {early_clobber_alts = 0, biggest_mode = SImode, type = OP_OUT, subreg_p = 0, early_clobber = 0, regno = 1282, next = 0x3cdb400} {early_clobber_alts = 0, biggest_mode = SImode, type = OP_IN, subreg_p = 0, early_clobber = 0, regno = 1256, next = 0x3cdb3e0} {early_clobber_alts = 0, biggest_mode = SImode, type = OP_IN, subreg_p = 0, early_clobber = 0, regno = 1258, next = 0x3cdb3c0} {early_clobber_alts = 0, biggest_mode = CCUmode, type = OP_IN, subreg_p = 0, early_clobber = 0, regno = 33, next = 0x0} hardregs: {early_clobber_alts = 18446744073709551615, biggest_mode = CCmode, type = OP_OUT, subreg_p = 0, early_clobber = 1, regno = 33, next = 0x0} Marking r33 as early_clobber output makes it dead before insn 472 here: lra-lives.c(915) /* Mark early clobber outputs dead. */ for (reg = curr_id->regs; reg != NULL; reg = reg->next) if (reg->type == OP_OUT && reg_early_clobber_p (reg, n_alt) && ! reg->subreg_p) need_curr_point_incr |= mark_regno_dead (reg->regno, reg->biggest_mode, curr_point); Reaching insn 470 with r33 being dead the reg is consequently marked as "unused": (insn 470 25077 476 10 (set (reg:CCU 33 %cc) (compare:CCU (reg:DI 1277 [ _1997 ]) (mem/u/c:DI (reg:DI 14737) [5 S8 A64]))) "t.f90":48 1242 {*cmpdi_ccu} (expr_list:REG_UNUSED (reg:CC 33 %cc) (expr_list:REG_DEAD (reg:DI 14737) (nil Since r33 is also an input operand to insn 472 it should not be marked as early_clobber. The attached patch prevents that and fixes the problem for me.
[Bug rtl-optimization/80818] LRA clobbers live hard reg clobbered during rematerialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80818 ktkachov at gcc dot gnu.org changed: What|Removed |Added CC||ktkachov at gcc dot gnu.org --- Comment #1 from ktkachov at gcc dot gnu.org --- Looks somewhat similar to PR 80754 ?