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

           Summary: instcombine make a call to sqrt dead but fails to
                    remove it
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Jan Voung found this interesting test case:

---------------------------------------------------
define float @my_sqrt_f(float %d) nounwind {
entry:
  %0 = fpext float %d to double
  %1 = call double @sqrt(double %0) nounwind
  %2 = fptrunc double %1 to float
  ret float %2
}

declare double @sqrt(double) nounwind
------------------------------------------------


$ opt -instcombine test.ll -o test2.ll -S

Produces

----------------------------------------
define float @my_sqrt_f(float %d) nounwind {
entry:
  %0 = fpext float %d to double
  %1 = call double @sqrt(double %0) nounwind
  %2 = call float @sqrtf(float %d) nounwind
  ret float %2
}

declare double @sqrt(double) nounwind

declare float @sqrtf(float) nounwind
-------------------------------------

Since sqrt is not side effect free, we are now stuck with both calls.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- 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