public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/33259]  New: limited range of remainder operation can prove loop runs at most once
@ 2007-08-31  8:05 raeburn at raeburn dot org
  2007-08-31  8:06 ` [Bug tree-optimization/33259] " raeburn at raeburn dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: raeburn at raeburn dot org @ 2007-08-31  8:05 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <bug-33259-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-09-05 22:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-31  8:05 [Bug tree-optimization/33259] New: limited range of remainder operation can prove loop runs at most once raeburn at raeburn dot org
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
     [not found] <bug-33259-4@http.gcc.gnu.org/bugzilla/>
2011-09-05 22:46 ` raeburn at raeburn dot org

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).