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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to