Skip to content

Commit 54efb00

Browse files
committed
Add an extra commuted select test.
1 parent aaf053d commit 54efb00

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

llvm/test/Transforms/Attributor/nofpclass-phiselect.ll

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,30 @@ exit:
2525
ret float %select
2626
}
2727

28+
define float @phi_select_c(i1 %c, float nofpclass(inf) %base, float nofpclass(inf) %arg) {
29+
; CHECK-LABEL: define nofpclass(inf) float @phi_select_c
30+
; CHECK-SAME: (i1 [[C:%.*]], float nofpclass(inf) [[BASE:%.*]], float nofpclass(inf) [[ARG:%.*]]) #[[ATTR0]] {
31+
; CHECK-NEXT: entry:
32+
; CHECK-NEXT: br label [[LOOP:%.*]]
33+
; CHECK: loop:
34+
; CHECK-NEXT: [[PHI:%.*]] = phi float [ [[BASE]], [[ENTRY:%.*]] ], [ [[SELECT:%.*]], [[LOOP]] ]
35+
; CHECK-NEXT: [[SELECT]] = select i1 [[C]], float [[ARG]], float [[PHI]]
36+
; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[EXIT:%.*]]
37+
; CHECK: exit:
38+
; CHECK-NEXT: ret float [[SELECT]]
39+
;
40+
entry:
41+
br label %loop
42+
43+
loop:
44+
%phi = phi float [ %base, %entry ], [ %select, %loop ]
45+
%select = select i1 %c, float %arg, float %phi
46+
br i1 %c, label %loop, label %exit
47+
48+
exit:
49+
ret float %select
50+
}
51+
2852
define float @phi_select_onlybase(i1 %c, float nofpclass(inf) %base, float %arg) {
2953
; CHECK-LABEL: define float @phi_select_onlybase
3054
; CHECK-SAME: (i1 [[C:%.*]], float nofpclass(inf) [[BASE:%.*]], float [[ARG:%.*]]) #[[ATTR0]] {

0 commit comments

Comments
 (0)