public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "wjwray at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96252] New: mis-optimization where identical functions have very different codegen since gcc 10 Date: Mon, 20 Jul 2020 15:02:03 +0000 [thread overview] Message-ID: <bug-96252-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96252 Bug ID: 96252 Summary: mis-optimization where identical functions have very different codegen since gcc 10 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wjwray at gmail dot com Target Milestone: --- (Stumbled on this odd effect while examining codegen for operator<=>) The reduced sample compiles c++11 and up (std version likely irrelevant) with the different codegen occurring since GCC 10. Two identical functions: bool cmp_x(cmp l, cmp r) noexcept { return std::lexicographical_compare(begin(l),end(l) ,begin(r),end(r)); } bool cmp_y(cmp l, cmp r) noexcept { return std::lexicographical_compare(begin(l),end(l) ,begin(r),end(r)); } generate very different code for cmp = array<int,64> at -O2 and -O3. The first is looping, the second has much longer unrolled codegen. My benchmarks show 40% difference in runtime, quick-bench shows 30%. Compiler Explorer https://godbolt.org/z/97box6 Quick-bench 1.3x https://quick-bench.com/q/480qkw1sP4OWOH6JBxsm-J_9uOk (Adding -fno-inline may provide a clue.)
next reply other threads:[~2020-07-20 15:02 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-20 15:02 wjwray at gmail dot com [this message] 2020-07-20 17:32 ` [Bug c++/96252] " wjwray at gmail dot com 2020-07-21 6:57 ` [Bug ipa/96252] " rguenth at gcc dot gnu.org 2020-07-21 6:58 ` [Bug ipa/96252] [10/11 Regression] " rguenth at gcc dot gnu.org 2020-07-23 6:51 ` rguenth at gcc dot gnu.org 2021-02-14 23:16 ` hubicka at gcc dot gnu.org 2021-02-15 14:40 ` hubicka at ucw dot cz 2021-04-08 12:02 ` rguenth at gcc dot gnu.org 2021-11-22 6:42 ` [Bug ipa/96252] [10/11/12 " pinskia at gcc dot gnu.org 2022-06-28 10:41 ` [Bug ipa/96252] [10/11/12/13 " jakub at gcc dot gnu.org 2023-07-07 10:37 ` [Bug ipa/96252] [11/12/13/14 " rguenth at gcc dot gnu.org 2024-05-15 7:12 ` [Bug ipa/96252] [11/12/13/14/15 " pinskia at gcc dot gnu.org 2024-05-15 7:20 ` pinskia at gcc dot gnu.org 2024-05-15 7:41 ` jakub 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-96252-4@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).