[llvm-bugs] [Bug 27794] New: missing optimization of multiply overflow check

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 17 12:44:38 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27794

            Bug ID: 27794
           Summary: missing optimization of multiply overflow check
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: regehr at cs.utah.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This is a portable, UB-free idiom for seeing if a multiply is going to
overflow:

  int f(unsigned a, unsigned b) { return a > (UINT_MAX / b); }

we should turn this into a multiply with condition code and then also CSE it
with the multiply itself which will surely be nearby.

Request for this optimization comes from Rich Felker, author of Musl libc:

  http://wiki.musl-libc.org/wiki/Projects_using_musl

This should be done in CodeGenPrepare, Sanjoy Das says.

-- 
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/20160517/5feeabcf/attachment.html>


More information about the llvm-bugs mailing list