public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "congh at google dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/58915] New: [missed optimization] GCC fails to get the loop bound for some loops. Date: Tue, 29 Oct 2013 20:08:00 -0000 [thread overview] Message-ID: <bug-58915-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58915 Bug ID: 58915 Summary: [missed optimization] GCC fails to get the loop bound for some loops. Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: congh at google dot com Getting the correct loop upper bound is important for some optimizations. GCC tries to get this bound by calling bound_difference() in tree-ssa-loop-niters.c, where GCC finds all control-dependent predicates of the loop and attempt to extract bound information from each predicate. However, GCC fails to get the bound for some loops. Below shows such an example: unsigned int i; if (i > 0) { ... if (i < 4) { do { ... --i; } while (i > 0); } } Clearly the upper bound is 3. But GCC could not get it for this loop. The reason is that GCC check i<4 (i could be zero) and i>0 separately and from neither condition can the upper bound be calculated. Those two conditions may not be combined into one as there may exist other statements between them. One possible solution is letting GCC collect all conditions first then merge them before calculating the upper bound. Any comments?
next reply other threads:[~2013-10-29 20:08 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-10-29 20:08 congh at google dot com [this message] 2013-10-30 10:23 ` [Bug tree-optimization/58915] " rguenth at gcc dot gnu.org 2013-10-30 23:52 ` congh at google dot com 2013-11-04 14:19 ` rguenth at gcc dot gnu.org 2021-12-12 10:10 ` pinskia at gcc dot gnu.org 2021-12-12 10:16 ` 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-58915-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).