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

            Bug ID: 35844
           Summary: Missed optimization in math expression: optimize
                    double comparing
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangb...@nondot.org
          Reporter: zamazan...@tut.by
                CC: llvm-bugs@lists.llvm.org

clang trunk with '-O3 -ffast-math -std=c++17' for this code:


double test(double x, double y)
{
    if(x != y)
    {
        return 42.0;
    }
    return x/y;
}


generates this code:

.LCPI0_0:
  .quad 4631107791820423168 # double 42
test(double, double): # @test(double, double)
  ucomisd xmm0, xmm1
  je .LBB0_2
  movsd xmm0, qword ptr [rip + .LCPI0_0] # xmm0 = mem[0],zero
  ret
.LBB0_2:
  divsd xmm0, xmm1
  ret


but we can optimize here divide operation and just return 1.0.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to