llvm-mirror/test/Transforms/SimplifyCFG/clamp.ll
Eric Christopher a62270de2c Revert "Temporarily Revert "Add basic loop fusion pass.""
The reversion apparently deleted the test/Transforms directory.

Will be re-reverting again.

llvm-svn: 358552
2019-04-17 04:52:47 +00:00

23 lines
757 B
LLVM

; 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
}