[LLVMbugs] [Bug 20627] New: Missed optimization for constant remainder of loop induction variable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 11 16:19:21 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20627

            Bug ID: 20627
           Summary: Missed optimization for constant remainder of loop
                    induction variable
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The optimizer should be able to eliminate the remainder operation in:
--
_Bool cond();
int f0(int N) {
    int i = 0, res = 0;
    while (cond()) {
        if ((i % 3) == 0)
            res++;
        ++i;
    }
    return res;
}
--
by introducing a new loop carried variable i' == (i % 3) and rewriting to:
--
...
  if (i' == 0) {
    ...
  }
  ...
  ++i'
  if (i' == 3)
    i' = 0
...
--

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140811/71036262/attachment.html>


More information about the llvm-bugs mailing list