1; RUN: opt < %s -simplifycfg -S | FileCheck %s
2
3define float @clamp(float %a, float %b, float %c) {
4; CHECK-LABEL: @clamp
5; CHECK:  %cmp = fcmp ogt float %a, %c
6; CHECK:  %cmp1 = fcmp olt float %a, %b
7; CHECK:  %cond = select i1 %cmp1, float %b, float %a
8; CHECK:  %cond5 = select i1 %cmp, float %c, float %cond
9; CHECK:  ret float %cond5
10entry:
11  %cmp = fcmp ogt float %a, %c
12  br i1 %cmp, label %cond.end4, label %cond.false
13
14cond.false:                                       ; preds = %entry
15  %cmp1 = fcmp olt float %a, %b
16  %cond = select i1 %cmp1, float %b, float %a
17  br label %cond.end4
18
19cond.end4:                                        ; preds = %entry, %cond.false
20  %cond5 = phi float [ %cond, %cond.false ], [ %c, %entry ]
21  ret float %cond5
22}
23