From: James Molloy Date: Fri, 13 Feb 2015 11:08:40 +0000 (+0000) Subject: [SimplifyCFG] Add test for r229099 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=acbbf932e98244a6150b76993cdedeacc3fb9527;p=oota-llvm.git [SimplifyCFG] Add test for r229099 Add extra test that was accidentally not staged. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229101 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/SimplifyCFG/clamp.ll b/test/Transforms/SimplifyCFG/clamp.ll new file mode 100644 index 00000000000..d21894a1269 --- /dev/null +++ b/test/Transforms/SimplifyCFG/clamp.ll @@ -0,0 +1,22 @@ +; RUN: opt < %s -simplifycfg -S | FileCheck %s + +define float @clamp(float %a, float %b, float %c) { +; CHECK-LABEL: @clamp +; CHECK: %cmp = fcmp ogt float %a, %c +; CHECK: %cmp1 = fcmp olt float %a, %b +; CHECK: %cond = select i1 %cmp1, float %b, float %a +; CHECK: %cond5 = select i1 %cmp, float %c, float %cond +; CHECK: ret float %cond5 +entry: + %cmp = fcmp ogt float %a, %c + br i1 %cmp, label %cond.end4, label %cond.false + +cond.false: ; preds = %entry + %cmp1 = fcmp olt float %a, %b + %cond = select i1 %cmp1, float %b, float %a + br label %cond.end4 + +cond.end4: ; preds = %entry, %cond.false + %cond5 = phi float [ %cond, %cond.false ], [ %c, %entry ] + ret float %cond5 +}