public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/51491] ccp when converting from alloca should add a CLOBBER to right before __builtin_stack_restore Date: Mon, 12 Dec 2011 21:33:00 -0000 [thread overview] Message-ID: <bug-51491-4-waDbdU8u9B@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-51491-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51491 --- Comment #4 from vries at gcc dot gnu.org 2011-12-12 21:25:58 UTC --- f1.c vs. f.c: ... int g(int*); int g(int*); int f1(void) | int f(void) { { int tt = 0; int tt = 0; int t = 4; int t = 4; { { int a[4]; | int a[t]; tt = g(a); tt = g(a); tt += a[0]; tt += a[0]; } } { { int a[4]; int a[4]; tt += g(a); tt += g(a); tt += a[0]; tt += a[0]; } } return tt; return tt; } } ... f1.c and f.c are compiled like this (for x86_64): ... $ gcc -O2 -S f.c f1.c -fdump-tree-all ... f1.c.149t.optimized has 2 clobbers: ... f1 () { int a[4]; int a[4]; int tt; int D.1712; int D.1711; int D.1710; <bb 2>: tt_3 = g (&a); D.1710_4 = a[0]; tt_5 = D.1710_4 + tt_3; a ={v} {CLOBBER}; D.1711_6 = g (&a); tt_7 = D.1711_6 + tt_5; D.1712_8 = a[0]; tt_9 = D.1712_8 + tt_7; a ={v} {CLOBBER}; return tt_9; } ... f.c.149t.optimized has only 1 clobbers: ... f () { <unnamed-unsigned:8> D.1726[16]; int a[4]; int tt; int D.1722; int D.1721; void * saved_stack.2; int D.1719; <bb 2>: saved_stack.2_3 = __builtin_stack_save (); tt_18 = g (&D.1726); D.1719_19 = MEM[(int[0:D.1713] *)&D.1726][0]; tt_20 = D.1719_19 + tt_18; __builtin_stack_restore (saved_stack.2_3); D.1721_21 = g (&a); tt_22 = D.1721_21 + tt_20; D.1722_23 = a[0]; tt_24 = D.1722_23 + tt_22; a ={v} {CLOBBER}; return tt_24; } ... f1 uses only 16 bytes stack space, since the 2 'a[4]' arrays share the stack space: ... grep 'subq.*rsp' f1.s f.s f1.s: subq $16, %rsp f.s: subq $32, %rsp ...
next prev parent reply other threads:[~2011-12-12 21:26 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-10 0:47 [Bug tree-optimization/51491] New: " pinskia at gcc dot gnu.org 2011-12-12 10:38 ` [Bug tree-optimization/51491] " rguenth at gcc dot gnu.org 2011-12-12 13:14 ` vries at gcc dot gnu.org 2011-12-12 20:14 ` pinskia at gcc dot gnu.org 2011-12-12 21:33 ` vries at gcc dot gnu.org [this message] 2011-12-12 21:43 ` vries at gcc dot gnu.org 2011-12-12 22:24 ` jakub at gcc dot gnu.org 2011-12-13 15:02 ` vries at gcc dot gnu.org 2011-12-17 11:41 ` vries at gcc dot gnu.org 2011-12-17 11:43 ` vries at gcc dot gnu.org 2011-12-17 12:50 ` vries 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-51491-4-waDbdU8u9B@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).