public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/110035] Missed optimization for dependent assignment statements
Date: Mon, 05 Jun 2023 07:16:47 +0000	[thread overview]
Message-ID: <bug-110035-4-Dbkb1FJaxk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110035-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110035

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Pontakorn Prasertsuk from comment #7)
> For the LLVM IR code of the snippet I provided, Clang's alias analysis can
> prove that `new` call has no side effect to other memory location. This is
> indicated by `noalias` keyword at the return value of the `new` call (_Znwm).
> 
> According to Clang's Language Reference:
> "On function return values, the noalias attribute indicates that the
> function acts like a system memory allocation function, returning a pointer
> to allocated storage disjoint from the storage for any other object
> accessible to the caller."
> 
> Is this possible for GCC alias analysis pass?

>   MyClass c = a;
>   MyClass *b = new MyClass;
>   *b = c;

the point is that 'new' can alter the value of 'a', GCC already knows that
'b' is distinct from c and a but that's not the relevant thing.  It looks
like LLVM creates wrong-code here.

  parent reply	other threads:[~2023-06-05  7:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30  8:35 [Bug tree-optimization/110035] New: " ptk.prasertsuk at gmail dot com
2023-05-30 11:55 ` [Bug tree-optimization/110035] " rguenth at gcc dot gnu.org
2023-05-30 16:45 ` pinskia at gcc dot gnu.org
2023-05-30 17:22 ` pinskia at gcc dot gnu.org
2023-05-31  1:20 ` ptk.prasertsuk at gmail dot com
2023-05-31  1:46 ` ptk.prasertsuk at gmail dot com
2023-05-31  6:34 ` rguenther at suse dot de
2023-06-03  0:23 ` ptk.prasertsuk at gmail dot com
2023-06-05  7:16 ` rguenth at gcc dot gnu.org [this message]
2023-06-05  7:58 ` ptk.prasertsuk at gmail dot com
2023-06-05  8:11 ` rguenther at suse dot de
2023-06-06  5:46 ` ptk.prasertsuk at gmail dot com
2023-06-06  5:49 ` ptk.prasertsuk at gmail dot com
2023-06-06  8:17 ` rguenther at suse dot de
2023-06-06  8:29 ` rguenth at gcc dot gnu.org
2023-06-06  9:12 ` amonakov at gcc dot gnu.org
2023-06-06 11:54 ` rguenther at suse dot de
2024-05-24  7:50 ` user202729 at protonmail 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-110035-4-Dbkb1FJaxk@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: link
Be 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).