Home | History | Annotate | Download | only in InstCombine
      1 ; Check that we skip transformations if the attribute unsafe-fp-math
      2 ; is not set.
      3 ; RUN: opt < %s -instcombine -S | FileCheck %s
      4 
      5 define float @mysqrt(float %x, float %y) #0 {
      6 entry:
      7   %x.addr = alloca float, align 4
      8   %y.addr = alloca float, align 4
      9   store float %x, float* %x.addr, align 4
     10   store float %y, float* %y.addr, align 4
     11   %0 = load float, float* %x.addr, align 4
     12   %1 = load float, float* %x.addr, align 4
     13   %mul = fmul fast float %0, %1
     14   %2 = call float @llvm.sqrt.f32(float %mul)
     15   ret float %2
     16 }
     17 
     18 declare float @llvm.sqrt.f32(float) #1
     19 
     20 ; CHECK: define float @mysqrt(float %x, float %y) {
     21 ; CHECK: entry:
     22 ; CHECK:   %mul = fmul fast float %x, %x
     23 ; CHECK:   %0 = call float @llvm.sqrt.f32(float %mul)
     24 ; CHECK:   ret float %0
     25 ; CHECK: }
     26