[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 Georg-Johann Lay changed: What|Removed |Added Keywords||wrong-code Target Milestone|4.3.6 |4.5.3
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 Georg-Johann Lay changed: What|Removed |Added Status|NEW |RESOLVED CC||gjl at gcc dot gnu.org Known to work||4.5.3, 4.6.0 Resolution||FIXED Known to fail|| --- Comment #22 from Georg-Johann Lay 2011-04-14 15:37:51 UTC --- Closed as resolved+fixed in 4.5.3, 4.6.0
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #21 from denisc at gcc dot gnu.org 2011-03-03 16:58:34 UTC --- Author: denisc Date: Thu Mar 3 16:58:26 2011 New Revision: 170657 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170657 Log: Backport from mainline 2011-02-22 Georg-Johann Lay PR target/42240 * config/avr/avr.c (avr_cannot_modify_jumps_p): New function. (TARGET_CANNOT_MODIFY_JUMPS_P): Define. Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/config/avr/avr.c
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #20 from denisc at gcc dot gnu.org 2011-02-27 08:36:58 UTC --- Author: denisc Date: Sun Feb 27 08:36:55 2011 New Revision: 170534 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170534 Log: 2011-02-22 Georg-Johann Lay PR target/42240 * config/avr/avr.c (avr_cannot_modify_jumps_p): New function. (TARGET_CANNOT_MODIFY_JUMPS_P): Define. Modified: trunk/gcc/ChangeLog trunk/gcc/config/avr/avr.c
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #19 from Georg Lay 2010-11-10 13:00:47 UTC --- (In reply to comment #18) > I think BBreordering after the end of epilogue in case of normal functions is > little confusing. Yes, optimized code is often confusing. > I am not sure what additional advantage we get by allowing this to happen > after > epilogue. Hence I tried to disable this. There is no bug for functions not attributed naked. I do not see why that should be changed. Note that the backend is lying about branch costs and sets them to zero -- both in space and time. Therefore, .bbro has fun and jumps around. Tweaking that is of no concern here. > > Moreover, there is a gap between reload_completed and > > epilogue_completed > > Agreed. Thanks for catching that. > > > > because the naked return insn is allowed since after reload. > > I dindn't quite get this. Can you give some example? avr.h allows that insn after reload: (define_insn "return_from_naked_epilogue" [(return)] "(reload_completed && cfun->machine && cfun->machine->is_naked)" ... so it might be emitted after reload. Because it is non-simple, it will occur just once, but it must be in the right place (ensured by .pro_and_epilogue) and must not be moved around (ensured by new target hook). Observe a simple test case like lined out below, and how the compiler transform with/without naked, optimize size/speed, branch cost 0/!=0 char c; void foo (char i) { c = 17; switch (i) { case 0 : c = 1; break; case 3 : c = 2; break; case 7 : c = 12; break; case 9 : c = 32; break; } }
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #18 from Anitha Boyapati 2010-11-10 10:38:33 UTC --- (In reply to comment #17) > (In reply to comment #14) > > Created attachment 22339 [details] [details] > > Initial patch to fix the bug > > > > BB reordering pass is suppressed for naked functions. Also suppressed when > > the > > end of epilogue is reached. > > BBreordering (or other passes doing similar things) need not to be disabled. > What do you think? I think BBreordering after the end of epilogue in case of normal functions is little confusing. For e.g., the same testcase with naked removed generates the following code without the patch. .L6: sts (seedram)+1,r25 sts seedram,r24 /* epilogue start */ ret .L11: ldi r24,lo8(0) ldi r25,hi8(0) rjmp .L6 I am not sure what additional advantage we get by allowing this to happen after epilogue. Hence I tried to disable this. Ofcourse, I still need to run entire regression to see if this causes any side affect. > Moreover, there is a gap between reload_completed and > epilogue_completed Agreed. Thanks for catching that. > because the naked return insn is allowed since after reload. I dindn't quite get this. Can you give some example?
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #17 from Georg Lay 2010-11-09 17:20:59 UTC --- (In reply to comment #14) > Created attachment 22339 [details] > Initial patch to fix the bug > > BB reordering pass is suppressed for naked functions. Also suppressed when the > end of epilogue is reached. BBreordering (or other passes doing similar things) need not to be disabled. What do you think? Moreover, there is a gap between reload_completed and epilogue_completed because the naked return insn is allowed since after reload. Georg
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #16 from Georg Lay 2010-11-09 17:16:02 UTC --- Created attachment 22349 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22349 PR target/42240
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #15 from Anitha Boyapati 2010-11-09 10:26:04 UTC --- (In reply to comment #13) > Implement TARGET_CANNOT_MODIFY_JUMPS_P and respect epilogue_completed and > cfun->machine->is_naked. This will stop BB reorder and similar post-epilogue > passes from moving the non-code-producing return-insn up. Yes, BB reordering pass is shifting jump blocks. Attached patch solves the issue. The output is: .brsh .L11| brlo .L5 > ldi r24, lo8(0) > ldi r25, hi8(0) > rjmp .L6 > L5: .L11: < ldi r24, lo8(0) < ldi r25, hi8(0) < rjmp .L6 <
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 --- Comment #14 from Anitha Boyapati 2010-11-09 10:24:11 UTC --- Created attachment 22339 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22339 Initial patch to fix the bug BB reordering pass is suppressed for naked functions. Also suppressed when the end of epilogue is reached.
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 Georg Lay changed: What|Removed |Added CC||avr at gjlay dot de --- Comment #13 from Georg Lay 2010-11-04 11:14:15 UTC --- Implement TARGET_CANNOT_MODIFY_JUMPS_P and respect epilogue_completed and cfun->machine->is_naked. This will stop BB reorder and similar post-epilogue passes from moving the non-code-producing return-insn up.
[Bug target/42240] [4.3/4.4 Regression] wrong epilogue on naked function
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Summary|[4.3/4.4 Regression, avr] |[4.3/4.4 Regression] wrong |wrong epilogue on naked |epilogue on naked function |function| Target Milestone|--- |4.3.6 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240