public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "macro@linux-mips.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/59371] [4.8/4.9 Regression] Performance regression in GCC 4.8 and later versions. Date: Thu, 09 Jan 2014 20:40:00 -0000 [thread overview] Message-ID: <bug-59371-4-AmwSaRJj7S@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-59371-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59371 --- Comment #10 from Maciej W. Rozycki <macro@linux-mips.org> --- (In reply to Jakub Jelinek from comment #9) Jakub, The fix has corrected the evaluation of `i++' however it has regressed the evaluation of `i < c'. This is because in the loop `i' is only ever assigned values that are lower than or equal to the value of `c' and here the `int' type can represent all values representable with the `signed short' and `unsigned short' types. Specifically, assuming the properties of the MIPS target, where `int' is 32-bit wide and `short' is 16-bit wide, we have the following cases of the `c' input value here: 1. 0 -- the loop is not entered because `i' is preset to 0 and equals `c' right away. 2. [1,32767] -- `i' is incremented from 0 until it reaches the value of `c', at which point the loop terminates. 3. [32768,65535] -- `i' is incremented from 0 up to 32767, at which point it wraps around to -32768 and continues being incremented to 32767 again. And so on, and so on. It never reaches the value of `c' or any higher value and therefore the loop never terminates. Based on the above observations it is enough to check for `i == c' as the loop termination condition. So I think this is still a performance regression from the user's point of view even though I realise this may not necessarily be an optimisation GCC has been previously designed for. Therefore I'd prefer to keep the bug open until/unless we decide it's impractical to implement a code transformation that would restore previous performance. Maciej
next prev parent reply other threads:[~2014-01-09 20:40 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-12-02 17:59 [Bug target/59371] New: " sje at gcc dot gnu.org 2013-12-03 9:37 ` [Bug target/59371] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org 2013-12-03 16:42 ` sje at gcc dot gnu.org 2013-12-03 23:10 ` pinskia at gcc dot gnu.org 2013-12-04 1:49 ` macro@linux-mips.org 2013-12-04 1:52 ` pinskia at gcc dot gnu.org 2013-12-05 11:12 ` rguenth at gcc dot gnu.org 2013-12-05 23:43 ` macro@linux-mips.org 2013-12-17 10:33 ` jakub at gcc dot gnu.org 2013-12-19 15:37 ` rguenth at gcc dot gnu.org 2014-01-09 20:40 ` macro@linux-mips.org [this message] 2014-05-22 9:07 ` [Bug target/59371] [4.8/4.9/4.10 " rguenth at gcc dot gnu.org 2014-12-19 13:34 ` [Bug target/59371] [4.8/4.9/5 " jakub at gcc dot gnu.org 2015-03-13 20:18 ` sje at gcc dot gnu.org 2015-06-23 8:28 ` [Bug target/59371] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org 2015-06-26 20:02 ` [Bug target/59371] [4.9/5/6 " jakub at gcc dot gnu.org 2015-06-26 20:32 ` jakub at gcc dot gnu.org 2021-05-14 9:47 ` [Bug target/59371] [9/10/11/12 Regression] Performance regression in GCC 4.8/9/10/11/12 " jakub at gcc dot gnu.org 2021-05-17 2:57 ` guojiufu at gcc dot gnu.org 2021-05-17 3:11 ` guojiufu at gcc dot gnu.org 2021-06-01 8:06 ` rguenth at gcc dot gnu.org 2022-05-27 9:35 ` [Bug target/59371] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:30 ` jakub at gcc dot gnu.org 2023-07-07 10:30 ` [Bug target/59371] [11/12/13/14 " 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-59371-4-AmwSaRJj7S@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).