Home | History | Annotate | Download | only in GVN
      1 ; RUN: opt -gvn -S < %s | FileCheck %s
      2 
      3 define double @test1(double %x, double %y) {
      4 ; CHECK: @test1(double %x, double %y)
      5 ; CHECK: %add1 = fadd double %x, %y
      6 ; CHECK-NOT: fpmath
      7 ; CHECK: %foo = fadd double %add1, %add1
      8   %add1 = fadd double %x, %y, !fpmath !0
      9   %add2 = fadd double %x, %y
     10   %foo = fadd double %add1, %add2
     11   ret double %foo
     12 }
     13 
     14 define double @test2(double %x, double %y) {
     15 ; CHECK: @test2(double %x, double %y)
     16 ; CHECK: %add1 = fadd double %x, %y, !fpmath !0
     17 ; CHECK: %foo = fadd double %add1, %add1
     18   %add1 = fadd double %x, %y, !fpmath !0
     19   %add2 = fadd double %x, %y, !fpmath !0
     20   %foo = fadd double %add1, %add2
     21   ret double %foo
     22 }
     23 
     24 define double @test3(double %x, double %y) {
     25 ; CHECK: @test3(double %x, double %y)
     26 ; CHECK: %add1 = fadd double %x, %y, !fpmath !1
     27 ; CHECK: %foo = fadd double %add1, %add1
     28   %add1 = fadd double %x, %y, !fpmath !1
     29   %add2 = fadd double %x, %y, !fpmath !0
     30   %foo = fadd double %add1, %add2
     31   ret double %foo
     32 }
     33 
     34 define double @test4(double %x, double %y) {
     35 ; CHECK: @test4(double %x, double %y)
     36 ; CHECK: %add1 = fadd double %x, %y, !fpmath !1
     37 ; CHECK: %foo = fadd double %add1, %add1
     38   %add1 = fadd double %x, %y, !fpmath !0
     39   %add2 = fadd double %x, %y, !fpmath !1
     40   %foo = fadd double %add1, %add2
     41   ret double %foo
     42 }
     43 
     44 !0 = metadata !{ float 5.0 }
     45 !1 = metadata !{ float 2.5 }
     46