public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "theodort at inf dot ethz.ch" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112508] New: [14 Regression] Size regression when using -Os starting with r14-4089-gd45ddc2c04e Date: Mon, 13 Nov 2023 11:11:45 +0000 [thread overview] Message-ID: <bug-112508-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112508 Bug ID: 112508 Summary: [14 Regression] Size regression when using -Os starting with r14-4089-gd45ddc2c04e 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/qE79f7qvW Given the following code: static int b, c = 8, d, e, f, g = 9; static char h = 3; static void(a)(int, unsigned i) { if (!(((i) >= 1) && ((i) <= 3421036188))) { __builtin_unreachable(); } } int main1() { for (; h; --h) { for (; f <= 9; f++) { if (d) g = 0; if (e) continue; a(b, g && c); } e = d = 0; a(0, 3421036188); } } gcc-trunk -Os generates more and more complex code: main1: movl d(%rip), %edi movl g(%rip), %esi xorl %edx, %edx xorl %ecx, %ecx movb h(%rip), %r8b movl e(%rip), %r9d xorl %r10d, %r10d movl f(%rip), %eax testb %r8b, %r8b jne .L49 testb %r10b, %r10b je .L37 movb $0, h(%rip) testb %dl, %dl je .L41 movl %eax, f(%rip) jmp .L41 .L37: testb %dl, %dl je .L44 movl %eax, f(%rip) jmp .L44 .L41: movl %r9d, e(%rip) testb %cl, %cl je .L45 movl %esi, g(%rip) .L45: movl %edi, d(%rip) jmp .L47 .L44: testb %cl, %cl je .L47 movl %esi, g(%rip) .L47: xorl %eax, %eax ret .L49: pushq %rbx .L35: movl %eax, %r11d .L4: movl %r11d, %eax cmpl $9, %r11d jg .L51 testl %edi, %edi je .L3 movb $1, %cl xorl %esi, %esi .L3: movl %esi, %ebx incl %r11d orl %r9d, %ebx jne .L22 testb %r10b, %r10b je .L5 movb %r8b, h(%rip) testb %dl, %dl je .L7 movl %eax, f(%rip) jmp .L7 .L5: testb %dl, %dl je .L8 movl %eax, f(%rip) jmp .L8 .L7: xorl %esi, %esi movl %esi, e(%rip) testb %cl, %cl je .L9 xorl %edx, %edx movl %edx, g(%rip) .L9: movl %edi, d(%rip) .L19: .L22: movb $1, %dl jmp .L4 .L51: decl %r8d xorl %r9d, %r9d movb $1, %r10b xorl %edi, %edi testb %r8b, %r8b jne .L35 testb %r10b, %r10b je .L12 movb $0, h(%rip) testb %dl, %dl je .L14 movl %r11d, f(%rip) jmp .L14 .L12: testb %dl, %dl je .L16 movl %r11d, f(%rip) jmp .L16 .L14: movl %r9d, e(%rip) testb %cl, %cl je .L17 movl %esi, g(%rip) .L17: movl %edi, d(%rip) jmp .L18 .L8: xorl %eax, %eax movl %eax, g(%rip) jmp .L19 .L16: testb %cl, %cl je .L18 movl %esi, g(%rip) .L18: xorl %eax, %eax popq %rbx ret gcc-13 -Os -o 13.o test.c -c gcc-trunk -Os -o 14.o test.c -c size 13.o 14.o text data bss dec hex filename 235 8 12 255 ff 13.o 422 8 12 442 1ba 14.o gcc-13.2.0 -Os: main1: movb h(%rip), %dil xorl %r8d, %r8d xorl %esi, %esi xorl %ecx, %ecx movl d(%rip), %edx movl f(%rip), %eax movb $1, %r9b xorl %r11d, %r11d movl $10, %r10d .L2: testb %dil, %dil je .L5 movl %eax, %ecx .L6: cmpl $9, %ecx jg .L25 testl %edx, %edx movb $1, %r8b cmovne %r9d, %esi incl %ecx jmp .L6 .L25: movl %r10d, %edx movb $1, %cl subl %eax, %edx cmpl $10, %eax cmovg %r11d, %edx decl %edi addl %edx, %eax xorl %edx, %edx jmp .L2 .L5: testb %cl, %cl je .L7 xorl %edi, %edi movb $0, h(%rip) movl %edi, e(%rip) .L7: testb %r8b, %r8b je .L8 movl %eax, f(%rip) .L8: testb %sil, %sil je .L9 xorl %eax, %eax movl %eax, g(%rip) .L9: testb %cl, %cl je .L10 movl %edx, d(%rip) .L10: ret Bisects to r14-4089-gd45ddc2c04e
next reply other threads:[~2023-11-13 11:11 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-13 11:11 theodort at inf dot ethz.ch [this message] 2023-11-13 11:15 ` [Bug tree-optimization/112508] " rguenth at gcc dot gnu.org 2024-02-15 23:08 ` roger at nextmovesoftware dot com 2024-02-16 8:11 ` rguenth at gcc dot gnu.org 2024-02-16 8:20 ` rguenth at gcc dot gnu.org 2024-03-07 21:02 ` law at gcc dot gnu.org 2024-05-07 7:42 ` [Bug tree-optimization/112508] [14/15 " rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-112508-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).