[llvm-bugs] [Bug 38239] New: Missed simplication of division

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 19 21:50:18 PDT 2018


            Bug ID: 38239
           Summary: Missed simplication of division
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org


int f1(int x, int y, int z) {
    return (z * x) / (z * y);

f1(int, int, int):
  imul edi, edx
  imul esi, edx
  mov eax, edi
  idiv esi

Possibly, this can be transformed to "return x / y" ? z = 0 leads to "division
by zero is undefined".

f2(int, int):
  mov eax, edi
  idiv esi

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/20180720/e54518b1/attachment.html>

More information about the llvm-bugs mailing list