1 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
3 define float @clamp(float %a, float %b, float %c) {
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
11 %cmp = fcmp ogt float %a, %c
12 br i1 %cmp, label %cond.end4, label %cond.false
14 cond.false: ; preds = %entry
15 %cmp1 = fcmp olt float %a, %b
16 %cond = select i1 %cmp1, float %b, float %a
19 cond.end4: ; preds = %entry, %cond.false
20 %cond5 = phi float [ %cond, %cond.false ], [ %c, %entry ]