25 lines · plain
1; RUN: opt -S < %s -passes=gvn-sink | FileCheck %s2 3; CHECK-LABEL: sink4; CHECK-NOT: fneg5; CHECK: = phi6; CHECK: fneg7define float @sink(float %a, float %b, i1 %cmp) {8entry:9 br i1 %cmp, label %if.then, label %if.else10 11if.then:12 %sub = fsub float %a, %b13 %neg0 = fneg float %sub14 br label %if.end15 16if.else:17 %add = fadd float %a, %b18 %neg1 = fneg float %add19 br label %if.end20 21if.end:22 %phi = phi float [ %neg0, %if.then ], [ %neg1, %if.else ]23 ret float %phi24}25