[LLVMbugs] [Bug 8096] New: instcombine make a call to sqrt dead but fails to remove it

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 6 21:20:06 PDT 2010


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: unassignedbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu


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.



More information about the llvm-bugs mailing list