From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C85183858D37; Sun, 21 May 2023 15:25:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C85183858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684682758; bh=GZlrfZMGBuV65pmcb4sB7/06CziUpNEIRWjwMqn4WAA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VQ79zcQdiPcuZ1zE/kpckVwsDFmcv5sDK6CEEIn4gsrPO0SurR1ewLLLQB+4xRZXB f7a4jylNF6ru0yAZTuirY/smeZtMhIPfm3Rk3rmZWEtLSCEUZ2Jmky5qOPqtpbjkwR tnmIOQ1Sg42Gip9yMtQn3o/yGRBoqggoUWIaWRD8= From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/90706] [10/11/12/13 Regression] Useless code generated for stack / register operations on AVR Date: Sun, 21 May 2023 15:25:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 9.1.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D90706 --- Comment #23 from Georg-Johann Lay --- Created attachment 55130 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D55130&action=3Dedit Test case for -Os -mmcu=3Dattiny40 As it appears, this bug is not fixed completely. For the -mmcu=3Davrtiny architecture, there is still bloat for even the smallest test cases like: $ avr-gcc bloat.c -mmcu=3Dattiny40 -Os -S char func3 (char c) { return 1 + c; } "GCC: (GNU) 14.0.0 20230520 (experimental)" compiles this to: func3: push r28 ; 22 [c=3D4 l=3D1] pushqi1/0 push r29 ; 23 [c=3D4 l=3D1] pushqi1/0 push __tmp_reg__ ; 27 [c=3D4 l=3D1] *addhi3_sp in r28,__SP_L__ ; 38 [c=3D4 l=3D2] *movhi/7 in r29,__SP_H__ /* prologue: function */ /* frame size =3D 1 */ /* stack size =3D 3 */ mov r20,r24 ; 18 [c=3D4 l=3D1] movqi_insn/0 subi r20,lo8(-(1)) ; 19 [c=3D4 l=3D1] *addqi3/1 mov r24,r20 ; 21 [c=3D4 l=3D1] movqi_insn/0 /* epilogue start */ pop __tmp_reg__ ; 33 [c=3D4 l=3D1] *addhi3_sp pop r29 ; 34 [c=3D4 l=3D1] popqi pop r28 ; 35 [c=3D4 l=3D1] popqi ret ; 36 [c=3D0 l=3D1] return_from_epilogue For reference, avr-gcc v8 generates for this function: func3: /* prologue: function */ /* frame size =3D 0 */ /* stack size =3D 0 */ .L__stack_usage =3D 0 subi r24,lo8(-(1)) ; 6 [c=3D4 l=3D1] addqi3/1 /* epilogue start */ ret ; 17 [c=3D0 l=3D1] return=