public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/58483] missing optimization opportunity for const std::vector compared to std::array
Date: Tue, 30 May 2023 18:43:55 +0000	[thread overview]
Message-ID: <bug-58483-4-cfMuvzm963@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58483-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #17 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is related reduced testcase:
```

int f(void)
{
        int tt = 100;
        int t[3] = {10,20,30};
        int *t1 = new int[3];
        __builtin_memcpy(t1, t, sizeof(t));
        for(int *i = t1; i != &t1[3]; i++)
          tt += *i;
        delete[] t1;
        return tt;
}
```
Note in the above testcase we can remove the memcpy but not the operator
new/delete.  This is unlike the original testcase where memcpy is not removed
either.

      parent reply	other threads:[~2023-05-30 18:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 11:03 [Bug tree-optimization/58483] New: " dl.soluz at gmx dot net
2013-09-20 11:14 ` [Bug tree-optimization/58483] " glisse at gcc dot gnu.org
2013-09-20 11:17 ` dl.soluz at gmx dot net
2013-09-20 14:46 ` dl.soluz at gmx dot net
2013-09-28 18:52 ` dl.soluz at gmx dot net
2013-09-29  8:06 ` dl.soluz at gmx dot net
2013-10-03 23:57 ` glisse at gcc dot gnu.org
2013-10-08 10:43 ` glisse at gcc dot gnu.org
2014-05-28 12:24 ` glisse at gcc dot gnu.org
2014-06-04  5:48 ` dl.soluz at gmx dot net
2014-06-04  6:21 ` glisse at gcc dot gnu.org
2021-11-14 14:19 ` dl.soluz at gmx dot net
2023-05-30 18:43 ` pinskia at gcc dot gnu.org [this message]

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-58483-4-cfMuvzm963@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).