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 c++/97077] Missed loop unrolling with range for over initializer list Date: Thu, 17 Sep 2020 06:32:26 +0000 [thread overview] Message-ID: <bug-97077-4-CmWrxo8JSV@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-97077-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97077 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-09-17 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- This is because the second loop has a load from {0,1,2,3,4} in its body and thus appears larger to unroll (we don't estimate those loads to go away - a missed optimization). static const int C.0[5] = {0, 1, 2, 3, 4}; ... <bb 4> [local count: 894749065]: # __for_begin_19 = PHI <__for_begin_10(5), &C.0(7)> # prephitmp_3 = PHI <pretmp_15(5), 0(7)> # ivtmp_14 = PHI <ivtmp_8(5), 5(7)> foo (prephitmp_3); __for_begin_10 = __for_begin_19 + 4; ivtmp_8 = ivtmp_14 - 1; if (ivtmp_8 == 0) goto <bb 6>; [20.00%] else goto <bb 5>; [80.00%] <bb 5> [local count: 715756304]: pretmp_15 = MEM[(const int *)__for_begin_19 + 4B]; goto <bb 4>; [100.00%] Estimating sizes for loop 2 BB: 4, after_exit: 0 size: 2 foo (prephitmp_3); size: 1 __for_begin_10 = __for_begin_19 + 4; size: 1 ivtmp_8 = ivtmp_14 - 1; Induction variable computation will be folded away. size: 2 if (ivtmp_8 == 0) Exit condition will be eliminated in peeled copies. Exit condition will be eliminated in last copy. Constant conditional. BB: 5, after_exit: 1 size: 1 pretmp_15 = MEM[(const int *)__for_begin_19 + 4B]; size: 7-3, last_iteration: 6-3 Loop size: 7 Estimated size after unrolling: 12 Not unrolling loop 2: size would grow. Not unrolling loop 2: contains call and code would grow. at some point I had patches to improve this but they had negative ripple-down effects so I reverted them.
next prev parent reply other threads:[~2020-09-17 6:32 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-16 21:01 [Bug c++/97077] New: " bmburstein at gmail dot com 2020-09-17 6:32 ` rguenth at gcc dot gnu.org [this message] 2021-07-04 14:13 ` [Bug c++/97077] " magiblot at hotmail dot com 2021-12-11 1:31 ` pinskia at gcc dot gnu.org 2021-12-27 4:11 ` [Bug tree-optimization/97077] " pinskia 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-97077-4-CmWrxo8JSV@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).