public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "darkshikari at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/43827] New: Intrinsic possibility: does not alias global data Date: Wed, 21 Apr 2010 03:40:00 -0000 [thread overview] Message-ID: <bug-43827-19067@http.gcc.gnu.org/bugzilla/> (raw) Take this code snippet from x264: h->mc.mc_luma( pix , 64, m->p_fref, m->i_stride[0], omx, omy-1, bw, bh, &m->weight[0] ); h->mc.mc_luma( pix+16, 64, m->p_fref, m->i_stride[0], omx, omy+1, bw, bh, &m->weight[0] ); h->mc.mc_luma( pix+32, 64, m->p_fref, m->i_stride[0], omx-1, omy, bw, bh, &m->weight[0] ); h->mc.mc_luma( pix+48, 64, m->p_fref, m->i_stride[0], omx+1, omy, bw, bh, &m->weight[0] ); After each call to mc_luma, gcc reloads h->mc.mc_luma, m->p_fref, and m->i_stride[0] even if restrict is used. It does this because it cannot prove at compile-time that none of these are pointers to some global data which mc_luma might modify. Being that mc_luma is a function pointer, even link-time optimization may have trouble proving this sort of thing. Obviously we could create local variables for all of these values, but when trying to optimize huge amounts of code, this quickly becomes ugly and messy. A solution for this problem might be an intrinsic to tell gcc that a particular pointer never aliases global/static data and thus can be assumed to be unchanged across function calls--and thus does not need to be reloaded. Another, similar solution might be an intrinsic that says that a given function never modifies global state. This could be applied to a function pointer as well as a function. That would instead offload the task to the individual function instead of the individual pointer. Alexander Strange suggested that some of this might be possible in 4.6 given the IPA-PTA optimization framework, so I'm curious whether these ideas are feasible or not. -- Summary: Intrinsic possibility: does not alias global data Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: darkshikari at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43827
next reply other threads:[~2010-04-21 3:40 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-04-21 3:40 darkshikari at gmail dot com [this message] 2010-04-21 9:30 ` [Bug c/43827] " rguenth at gcc dot gnu dot org 2010-04-21 22:07 ` darkshikari at gmail dot com 2010-04-21 22:09 ` pinskia at gcc dot gnu dot org 2010-04-21 22:14 ` [Bug tree-optimization/43827] " rguenth at gcc dot gnu dot org 2010-04-21 22:25 ` [Bug c/43827] " darkshikari at gmail dot com 2010-04-22 6:31 ` darkshikari at gmail dot com
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-43827-19067@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).