1; RUN: opt < %s -mtriple=aarch64-linux-gnu -simplifycfg -hoist-common-insts=true -enable-unsafe-fp-math -S >%t 2; RUN: FileCheck %s < %t 3; ModuleID = 't.cc' 4 5; Function Attrs: nounwind 6define double @_Z3fooRdS_S_S_(double* dereferenceable(8) %x, double* dereferenceable(8) %y, double* dereferenceable(8) %a) #0 { 7entry: 8 %0 = load double, double* %y, align 8 9 %cmp = fcmp oeq double %0, 0.000000e+00 10 %1 = load double, double* %x, align 8 11 br i1 %cmp, label %if.then, label %if.else 12 13; fadd (const, (fmul x, y)) 14if.then: ; preds = %entry 15; CHECK-LABEL: if.then: 16; CHECK: %3 = fmul fast double %1, %2 17; CHECK-NEXT: %mul = fadd fast double 1.000000e+00, %3 18 %2 = load double, double* %a, align 8 19 %3 = fmul fast double %1, %2 20 %mul = fadd fast double 1.000000e+00, %3 21 store double %mul, double* %y, align 8 22 br label %if.end 23 24; fsub ((fmul x, y), z) 25if.else: ; preds = %entry 26; CHECK-LABEL: if.else: 27; CHECK: %mul1 = fmul fast double %1, %2 28; CHECK-NEXT: %sub1 = fsub fast double %mul1, %0 29 %4 = load double, double* %a, align 8 30 %mul1 = fmul fast double %1, %4 31 %sub1 = fsub fast double %mul1, %0 32 %gep1 = getelementptr double, double* %y, i32 1 33 store double %sub1, double* %gep1, align 8 34 br label %if.end 35 36if.end: ; preds = %if.else, %if.then 37 %5 = load double, double* %y, align 8 38 %cmp2 = fcmp oeq double %5, 2.000000e+00 39 %6 = load double, double* %x, align 8 40 br i1 %cmp2, label %if.then2, label %if.else2 41 42; fsub (x, (fmul y, z)) 43if.then2: ; preds = %entry 44; CHECK-LABEL: if.then2: 45; CHECK: %7 = fmul fast double %5, 3.000000e+00 46; CHECK-NEXT: %mul2 = fsub fast double %6, %7 47 %7 = load double, double* %a, align 8 48 %8 = fmul fast double %6, 3.0000000e+00 49 %mul2 = fsub fast double %7, %8 50 store double %mul2, double* %y, align 8 51 br label %if.end2 52 53; fsub (fneg((fmul x, y)), const) 54if.else2: ; preds = %entry 55; CHECK-LABEL: if.else2: 56; CHECK: %mul3 = fmul fast double %5, 3.000000e+00 57; CHECK-NEXT: %neg = fsub fast double 0.000000e+00, %mul3 58; CHECK-NEXT: %sub2 = fsub fast double %neg, 3.000000e+00 59 %mul3 = fmul fast double %6, 3.0000000e+00 60 %neg = fsub fast double 0.0000000e+00, %mul3 61 %sub2 = fsub fast double %neg, 3.0000000e+00 62 store double %sub2, double* %y, align 8 63 br label %if.end2 64 65if.end2: ; preds = %if.else, %if.then 66 %9 = load double, double* %x, align 8 67 %10 = load double, double* %y, align 8 68 %add = fadd fast double %9, %10 69 %11 = load double, double* %a, align 8 70 %add2 = fadd fast double %add, %11 71 ret double %add2 72} 73 74