[SimplifyCFG] add test for select with FMF; NFC

This commit is contained in:
Sanjay Patel 2019-11-13 16:45:17 -05:00
parent 15ae28193d
commit dc5ebdb4cf

View File

@ -1,11 +1,38 @@
; RUN: opt < %s -simplifycfg -S | not grep br
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -simplifycfg -S | FileCheck %s
define void @foo(i1 %C, i32* %P) {
br i1 %C, label %T, label %F
; CHECK-LABEL: @foo(
; CHECK-NEXT: store i32 7, i32* [[P:%.*]]
; CHECK-NEXT: ret void
;
br i1 %C, label %T, label %F
T: ; preds = %0
store i32 7, i32* %P
ret void
store i32 7, i32* %P
ret void
F: ; preds = %0
store i32 7, i32* %P
ret void
store i32 7, i32* %P
ret void
}
define float @PR39535min(float %x) {
; CHECK-LABEL: @PR39535min(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TOBOOL:%.*]] = fcmp une float [[X:%.*]], 0.000000e+00
; CHECK-NEXT: [[DOTX:%.*]] = select i1 [[TOBOOL]], float 0.000000e+00, float [[X]]
; CHECK-NEXT: ret float [[DOTX]]
;
entry:
%tobool = fcmp une float %x, 0.0
br i1 %tobool, label %cond.true, label %cond.false
cond.true:
br label %cond.end
cond.false:
br label %cond.end
cond.end:
%cond = phi fast float [ 0.0, %cond.true ], [ %x, %cond.false ]
ret float %cond
}