public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113689] [11/12/13/14 Regression] wrong code with -fprofile -mcmodel=large when needing drap register since r11-6548 Date: Thu, 01 Feb 2024 12:27:21 +0000 [thread overview] Message-ID: <bug-113689-4-tYse6oEBOT@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113689-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113689 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hjl.tools at gmail dot com, | |hubicka at gcc dot gnu.org, | |jakub at gcc dot gnu.org, | |uros at gcc dot gnu.org Priority|P3 |P2 Target Milestone|--- |11.5 Summary|wrong code with unused |[11/12/13/14 Regression] |_BitInt() division with -O2 |wrong code with -fprofile |-fprofile -mcmodel=large |-mcmodel=large when needing |-mavx |drap register since | |r11-6548 --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Seems like a backend bug to me, collision between function profiler after prologue and drap. I see foo: leaq 8(%rsp), %r10 andq $-32, %rsp pushq -8(%r10) pushq %rbp movq %rsp, %rbp pushq %r14 pushq %r13 pushq %r12 pushq %r10 pushq %rbx subq $200, %rsp 1: movabsq $mcount, %r10 call *%r10 xorl %eax, %eax xorl %edx, %edx movl $-511, %r9d addb $-1, %dl movq %rax, %rdx sbbq (%r10), %rdx This function is stack_realign_drap, find_drap_reg returns R10_REG and so ix86_get_drap_rtx uses %r10 as drap register. Later on pro_and_epilogue initializes the drap register in the prologue. And, final.cc when seeing NOTE_INSN_PROLOGUE_END emits the late FUNCTION_PROFILER, which seems to have clobbering of %r10 (and/or %r11) hardcoded in it, so it overwrites the drap value. One doesn't need _BitInt to reproduce: /* { dg-do run { target lp64 } } */ /* { dg-options "-O2 -fprofile -mcmodel=large" } */ __attribute__((noipa)) void bar (char *x, char *y, int *z) { x[0] = 42; y[0] = 42; if (z[0] != 16) __builtin_abort (); } __attribute__((noipa)) void foo (int c, int d, int e, int f, int g, int h, int z) { typedef char B[32]; B b __attribute__((aligned (32))); bar (&b[0], __builtin_alloca (z), &z); } int main () { foo (0, 0, 0, 0, 0, 0, 16); } Started with r11-6548-g1b885264a48dcd71b7aeb26c0abeb91246724897
next prev parent reply other threads:[~2024-02-01 12:27 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-31 20:32 [Bug target/113689] New: wrong code with unused _BitInt() division with -O2 -fprofile -mcmodel=large -mavx zsojka at seznam dot cz 2024-01-31 23:04 ` [Bug target/113689] " pinskia at gcc dot gnu.org 2024-02-01 12:27 ` jakub at gcc dot gnu.org [this message] 2024-02-01 12:39 ` [Bug target/113689] [11/12/13/14 Regression] wrong code with -fprofile -mcmodel=large when needing drap register since r11-6548 jakub at gcc dot gnu.org 2024-02-01 18:23 ` hjl.tools at gmail dot com 2024-02-05 19:08 ` cvs-commit at gcc dot gnu.org 2024-02-05 19:09 ` hjl.tools at gmail dot com 2024-02-06 18:30 ` ro at gcc dot gnu.org 2024-02-06 18:37 ` jakub at gcc dot gnu.org 2024-02-06 18:42 ` hjl.tools at gmail dot com 2024-02-06 18:50 ` jakub at gcc dot gnu.org 2024-02-06 18:58 ` hjl.tools at gmail dot com 2024-02-06 19:03 ` cvs-commit 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-113689-4-tYse6oEBOT@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).