public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/65330] restrict should be considered when folding through references from global vars Date: Sat, 07 Mar 2015 00:08:00 -0000 [thread overview] Message-ID: <bug-65330-4-q3tFdTADig@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-65330-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65330 --- Comment #3 from Jan Hubicka <hubicka at ucw dot cz> --- > I was thinking of sth else first - make sure that points-to analysis processes > initializers of readonly globals (when they bind to the current def). In when ctor_for_folding returns non-NULL; > your testcase the globals are not readonly - or did you mean to write > > int * const varptr = &var; > int * const __restrict__ varptr2 = &var; > > ? Your testcase also misses a declaration of 'var'. I did not quite finish the testcase because the restrict qualifier I was interested in was ignored. Yes, they would need to be declared either const or static (so the DECL_READONLY is derived by IPA code). This should be full testcase (-fmerge-all-constants is needed to get merging done, but to expose any problems testrestrict/testrestrict2 codegen would need to differ): int var; static const int *varptr=&var; static const int *__restrict__ varptr2=&var; static int *__restrict__ varptr3 = &var; static int *__restrict__ varptr4 = &var; int * return_valptr(int i) { return varptr[i]; } int * __restrict__ return_valptr2(int i) { return varptr2[i]; } int testrestrict () { int *ptr = return_valptr (0); *ptr = 0; *varptr3 = 1; return *ptr; } int testrestrict2 () { int *ptr = return_valptr2 (0); *ptr = 0; *varptr3 = 1; return *ptr; } int testrestrict4 () { *varptr4 = 0; *varptr3 = 1; return *varptr4; }
next prev parent reply other threads:[~2015-03-07 0:08 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-05 19:56 [Bug middle-end/65330] New: " hubicka at gcc dot gnu.org 2015-03-05 20:29 ` [Bug middle-end/65330] " hubicka at gcc dot gnu.org 2015-03-06 10:07 ` rguenth at gcc dot gnu.org 2015-03-07 0:08 ` hubicka at ucw dot cz [this message] 2015-03-09 13:55 ` 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-65330-4-q3tFdTADig@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).