Skip to content

Commit 01bda06

Browse files
committed
[InstCombine] Add test for issue fixed by 50fe87a.
Extra test that was fixed by 50fe87a to make sure it doesn't regress again.
1 parent ec4ecbd commit 01bda06

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

llvm/test/Transforms/InstCombine/sincospi.ll

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,46 @@ define double @test_fptr(ptr %fptr, double %p1) {
182182
%res = fadd double %sin, %cos
183183
ret double %res
184184
}
185+
186+
define i1 @test_cospif_used_in_branch_cond() {
187+
; CHECK-FLOAT-IN-VEC-LABEL: @test_cospif_used_in_branch_cond(
188+
; CHECK-FLOAT-IN-VEC-NEXT: entry:
189+
; CHECK-FLOAT-IN-VEC-NEXT: [[RES:%.*]] = call float @__cospif(float noundef 0.000000e+00)
190+
; CHECK-FLOAT-IN-VEC-NEXT: [[CMP:%.*]] = fcmp uno float [[RES]], 0.000000e+00
191+
; CHECK-FLOAT-IN-VEC-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
192+
; CHECK-FLOAT-IN-VEC: then:
193+
; CHECK-FLOAT-IN-VEC-NEXT: ret i1 false
194+
; CHECK-FLOAT-IN-VEC: else:
195+
; CHECK-FLOAT-IN-VEC-NEXT: ret i1 true
196+
;
197+
; CHECK-LABEL: @test_cospif_used_in_branch_cond(
198+
; CHECK-NEXT: entry:
199+
; CHECK-NEXT: [[RES:%.*]] = call float @__cospif(float noundef 0.000000e+00)
200+
; CHECK-NEXT: [[CMP:%.*]] = fcmp uno float [[RES]], 0.000000e+00
201+
; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
202+
; CHECK: then:
203+
; CHECK-NEXT: ret i1 false
204+
; CHECK: else:
205+
; CHECK-NEXT: ret i1 true
206+
;
207+
; CHECK-NO-SINCOS-LABEL: @test_cospif_used_in_branch_cond(
208+
; CHECK-NO-SINCOS-NEXT: entry:
209+
; CHECK-NO-SINCOS-NEXT: [[RES:%.*]] = call float @__cospif(float noundef 0.000000e+00)
210+
; CHECK-NO-SINCOS-NEXT: [[CMP:%.*]] = fcmp uno float [[RES]], 0.000000e+00
211+
; CHECK-NO-SINCOS-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
212+
; CHECK-NO-SINCOS: then:
213+
; CHECK-NO-SINCOS-NEXT: ret i1 false
214+
; CHECK-NO-SINCOS: else:
215+
; CHECK-NO-SINCOS-NEXT: ret i1 true
216+
;
217+
entry:
218+
%res = call float @__cospif(float noundef 0.000000e+00) #3
219+
%cmp = fcmp uno float %res, 0.000000e+00
220+
br i1 %cmp, label %then, label %else
221+
222+
then:
223+
ret i1 false
224+
225+
else:
226+
ret i1 true
227+
}

0 commit comments

Comments
 (0)