public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "raeburn at raeburn dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/33259]  New: limited range of remainder operation can prove loop runs at most once
Date: Fri, 31 Aug 2007 08:05:00 -0000	[thread overview]
Message-ID: <bug-33259-11337@http.gcc.gnu.org/bugzilla/> (raw)

The result of a signed remainder operation with a constant divisor is limited
in absolute value to less than the value of the divisor.  Following it with
code to force the remainder to be positive by adjusting the quotient and
remainder values is pretty straightforward.  However, if it's written as a loop
it doesn't get optimized well.

The rtl initially generated appears to have the loop transformed into
arithmetic to figure out the number of times the loop would run, in a branch
conditionalized on whether the loop would be run at all.  (Actually, it appears
to run the loop body once, and then do math to figure out how many more times.)
 However, the compiler doesn't figure out that in that branch, the loop body
would be run exactly once, either in the tree or rtl optimizations.


-- 
           Summary: limited range of remainder operation can prove loop runs
                    at most once
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raeburn at raeburn dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33259


             reply	other threads:[~2007-08-31  8:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-31  8:05 raeburn at raeburn dot org [this message]
2007-08-31  8:06 ` [Bug tree-optimization/33259] " raeburn at raeburn dot org
2008-08-16 18:19 ` raeburn at raeburn dot org
2008-12-27  7:20 ` pinskia at gcc dot gnu dot 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-33259-11337@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).