From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 402B13858D20; Wed, 15 Nov 2023 12:50:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 402B13858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700052615; bh=mWYVNyc3ewkoKzDKIczdOBAZIP7ZU9/lCS9Zwg249wM=; h=From:To:Subject:Date:From; b=JDdAbnbNtBWp97SPzDIqUFmPjMwsQwcNY3cCZISVCdNA77vqyxuk0yQZQBix4Rb6O IokUp6Zy8JMDDPaD0ystDMIev9AqFeGKALTqbWJAxqrCDDsnQIK4OZDaLAwJsr0pP6 v9YsuGh8lMpehFXIeRy3WUIHkf8icGbXKXqUPsRM= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112545] New: [14 Regression] Size regression when using -Os starting with r14-569-g21e2ef2dc25 Date: Wed, 15 Nov 2023 12:50:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: theodort at inf dot ethz.ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D112545 Bug ID: 112545 Summary: [14 Regression] Size regression when using -Os starting with r14-569-g21e2ef2dc25 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: theodort at inf dot ethz.ch Target Milestone: --- https://godbolt.org/z/hcq8sKhvP Given the following code: static struct { int a; int b; } c; static int d, e, g; static short f, i; static void h(unsigned short j) { c.a =3D i; if (!(((j) >=3D 1) && ((j) <=3D 65535))) { __builtin_unreachable(); } } int main1() { d =3D 6; for (; d !=3D -7; d--) { h(d ^ d < (0 <=3D 6)); if (d >=3D 12) if (e) { for (; f; ++f) g =3D c.b; if (g) e =3D 0; } } } gcc-trunk -Os generates significantly more complex code: main1: movl e(%rip), %ecx movl $6, %eax xorl %edi, %edi xorl %r8d, %r8d movl c+4(%rip), %r10d movl g(%rip), %esi xorl %r9d, %r9d movl $6, d(%rip) movw f(%rip), %dx .L2: cmpl $-7, %eax je .L31 xorl %r11d, %r11d testl %eax, %eax setle %r11b cmpw %ax, %r11w jne .L3 testb %r8b, %r8b je .L4 movl %eax, d(%rip) .L4: testb %dil, %dil je .L5 movl %ecx, e(%rip) .L5: xorl %ecx, %ecx movw %dx, f(%rip) movl %ecx, c(%rip) movl %esi, g(%rip) .L3: cmpl $11, %eax jle .L6 testl %ecx, %ecx je .L6 .L7: testw %dx, %dx je .L32 incl %edx movl %r10d, %esi movb $1, %r9b jmp .L7 .L32: testl %esi, %esi je .L6 movb $1, %dil xorl %ecx, %ecx .L6: decl %eax movb $1, %r8b jmp .L2 .L31: testb %r8b, %r8b je .L10 movl $-7, d(%rip) testb %dil, %dil je .L11 movl %ecx, e(%rip) .L11: xorl %eax, %eax movl %eax, c(%rip) .L12: testb %r9b, %r9b je .L13 movw %dx, f(%rip) movl %esi, g(%rip) jmp .L13 .L10: testb %dil, %dil je .L12 movl %ecx, e(%rip) jmp .L12 .L13: xorl %eax, %eax ret than gcc-13.2.0 -Os: main1: movl $-7, d(%rip) xorl %eax, %eax movl %eax, c(%rip) ret Bisects to r14-569-g21e2ef2dc25=