[LLVMbugs] [Bug 17683] New: Optimize division of positive signed integer by power of 2 to a simple shift

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 24 06:58:27 PDT 2013


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

            Bug ID: 17683
           Summary: Optimize division of positive signed integer by power
                    of 2 to a simple shift
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: st at quanttec.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

It would be nice if LLVM could optimize the division of a signed integer by a
power of two to a simple shift if the integer can not be negative.

For example, GCC optimizes the division in the following sample to a simple
right shift (without fixup), while LLVM does not:

int divBy4(int x) {
  if (x < 0) abort();
  return x/4;
}

-- 
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/20131024/bbadbd58/attachment.html>


More information about the llvm-bugs mailing list