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

            Bug ID: 21126
           Summary: missed optimization: recognize square root squared
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

It seems silly, but this actually happens in the real world...for example, in
code that does x ** 3/2 like:
http://benchmarksgame.alioth.debian.org/u32/program.php?test=nbody&lang=gcc&id=1

This should just return 'f':

$ cat sqrt_squared.ll
define double @foo(double %f) #0 {
  %sqrt = tail call double @llvm.sqrt.f64(double %f)
  %mul = fmul fast double %sqrt, %sqrt
  ret double %mul
}

; Function Attrs: nounwind readnone
declare double @llvm.sqrt.f64(double) #1

attributes #0 = { "unsafe-fp-math"="true" }
attributes #1 = { nounwind readnone

-- 
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