31 lines · plain
1; RUN: opt -S < %s -passes=gvn-hoist | FileCheck %s2 3declare void @llvm.sideeffect()4 5; GVN hoisting across a @llvm.sideeffect.6 7; CHECK-LABEL: scalarsHoisting8; CHECK: = fsub9; CHECK: br i1 %cmp,10; CHECK-NOT: fsub11define float @scalarsHoisting(float %d, float %m, float %a, i1 %cmp) {12entry:13 br i1 %cmp, label %if.then, label %if.else14 15if.then:16 call void @llvm.sideeffect()17 %sub0 = fsub float %m, %a18 %mul = fmul float %sub0, %d19 br label %if.end20 21if.else:22 %sub1 = fsub float %m, %a23 %div = fdiv float %sub1, %d24 br label %if.end25 26if.end:27 %phi = phi float [ %mul, %if.then ], [ %div, %if.else ]28 ret float %phi29}30 31