Skip to content

Commit be08af8

Browse files
committed
[SimplifyCFG] add test for select with FMF; NFC
1 parent 7858677 commit be08af8

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed
Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1-
; RUN: opt < %s -simplifycfg -S | not grep br
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt < %s -simplifycfg -S | FileCheck %s
23

34
define void @foo(i1 %C, i32* %P) {
4-
br i1 %C, label %T, label %F
5+
; CHECK-LABEL: @foo(
6+
; CHECK-NEXT: store i32 7, i32* [[P:%.*]]
7+
; CHECK-NEXT: ret void
8+
;
9+
br i1 %C, label %T, label %F
510
T: ; preds = %0
6-
store i32 7, i32* %P
7-
ret void
11+
store i32 7, i32* %P
12+
ret void
813
F: ; preds = %0
9-
store i32 7, i32* %P
10-
ret void
14+
store i32 7, i32* %P
15+
ret void
16+
}
17+
18+
define float @PR39535min(float %x) {
19+
; CHECK-LABEL: @PR39535min(
20+
; CHECK-NEXT: entry:
21+
; CHECK-NEXT: [[TOBOOL:%.*]] = fcmp une float [[X:%.*]], 0.000000e+00
22+
; CHECK-NEXT: [[DOTX:%.*]] = select i1 [[TOBOOL]], float 0.000000e+00, float [[X]]
23+
; CHECK-NEXT: ret float [[DOTX]]
24+
;
25+
entry:
26+
%tobool = fcmp une float %x, 0.0
27+
br i1 %tobool, label %cond.true, label %cond.false
28+
29+
cond.true:
30+
br label %cond.end
31+
32+
cond.false:
33+
br label %cond.end
34+
35+
cond.end:
36+
%cond = phi fast float [ 0.0, %cond.true ], [ %x, %cond.false ]
37+
ret float %cond
1138
}

0 commit comments

Comments
 (0)