Skip to content

Commit c29a50f

Browse files
committed
fix test
1 parent f7ece18 commit c29a50f

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3601,7 +3601,6 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
36013601
// Per POSIX, this MAY fail if Op is denormal. We choose not failing.
36023602
return true;
36033603

3604-
36053604
case LibFunc_asinl:
36063605
case LibFunc_asin:
36073606
case LibFunc_asinf:
@@ -3629,6 +3628,10 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
36293628
case LibFunc_sqrtf:
36303629
return Op.isNaN() || Op.isZero() || !Op.isNegative();
36313630

3631+
case LibFunc_erf:
3632+
case LibFunc_erff:
3633+
return true;
3634+
36323635
// FIXME: Add more functions: sqrt_finite, atanh, expm1, log1p,
36333636
// maybe others?
36343637
default:

llvm/test/Transforms/InstCombine/erf.ll

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
define float @erff_const() {
55
; CHECK-LABEL: define float @erff_const() {
6-
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 5.000000e-01)
76
; CHECK-NEXT: ret float 0x3FE0A7EF60000000
87
;
98
%r = call float @erff(float 5.000000e-01)
@@ -12,7 +11,6 @@ define float @erff_const() {
1211

1312
define double @erf_const() {
1413
; CHECK-LABEL: define double @erf_const() {
15-
; CHECK-NEXT: [[R:%.*]] = call double @erf(double -5.000000e-01)
1614
; CHECK-NEXT: ret double 0xBFE0A7EF5C18EDD2
1715
;
1816
%r = call double @erf(double -5.000000e-01)
@@ -21,7 +19,6 @@ define double @erf_const() {
2119

2220
define float @erff_zero() {
2321
; CHECK-LABEL: define float @erff_zero() {
24-
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 0.000000e+00)
2522
; CHECK-NEXT: ret float 0.000000e+00
2623
;
2724
%r = call float @erff(float 0.000000e+00)
@@ -30,7 +27,6 @@ define float @erff_zero() {
3027

3128
define double @erf_zero() {
3229
; CHECK-LABEL: define double @erf_zero() {
33-
; CHECK-NEXT: [[R:%.*]] = call double @erf(double 0.000000e+00)
3430
; CHECK-NEXT: ret double 0.000000e+00
3531
;
3632
%r = call double @erf(double 0.000000e+00)
@@ -39,7 +35,6 @@ define double @erf_zero() {
3935

4036
define float @erff_neg_zero() {
4137
; CHECK-LABEL: define float @erff_neg_zero() {
42-
; CHECK-NEXT: [[R:%.*]] = call float @erff(float -0.000000e+00)
4338
; CHECK-NEXT: ret float -0.000000e+00
4439
;
4540
%r = call float @erff(float -0.000000e+00)
@@ -48,7 +43,6 @@ define float @erff_neg_zero() {
4843

4944
define double @erf_neg_zero() {
5045
; CHECK-LABEL: define double @erf_neg_zero() {
51-
; CHECK-NEXT: [[R:%.*]] = call double @erf(double -0.000000e+00)
5246
; CHECK-NEXT: ret double -0.000000e+00
5347
;
5448
%r = call double @erf(double -0.000000e+00)
@@ -75,7 +69,7 @@ define double @erf_inf() {
7569

7670
define float @erff_inf_memory_none() {
7771
; CHECK-LABEL: define float @erff_inf_memory_none() {
78-
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 0x7FF0000000000000) #[[ATTR0:[0-9]+]]
72+
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 0x7FF0000000000000) #[[ATTR1:[0-9]+]]
7973
; CHECK-NEXT: ret float [[R]]
8074
;
8175
%r = call float @erff(float 0x7FF0000000000000) readnone
@@ -84,7 +78,7 @@ define float @erff_inf_memory_none() {
8478

8579
define double @erf_inf_memory_none() {
8680
; CHECK-LABEL: define double @erf_inf_memory_none() {
87-
; CHECK-NEXT: [[R:%.*]] = call double @erf(double 0x7FF0000000000000) #[[ATTR0]]
81+
; CHECK-NEXT: [[R:%.*]] = call double @erf(double 0x7FF0000000000000) #[[ATTR1]]
8882
; CHECK-NEXT: ret double [[R]]
8983
;
9084
%r = call double @erf(double 0x7FF0000000000000) readnone
@@ -111,7 +105,7 @@ define double @erf_neg_inf() {
111105

112106
define float @erff_neg_inf_memory_none() {
113107
; CHECK-LABEL: define float @erff_neg_inf_memory_none() {
114-
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 0xFFF0000000000000) #[[ATTR0]]
108+
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 0xFFF0000000000000) #[[ATTR1]]
115109
; CHECK-NEXT: ret float [[R]]
116110
;
117111
%r = call float @erff(float 0xFFF0000000000000) readnone
@@ -120,7 +114,7 @@ define float @erff_neg_inf_memory_none() {
120114

121115
define double @erf_neg_inf_memory_none() {
122116
; CHECK-LABEL: define double @erf_neg_inf_memory_none() {
123-
; CHECK-NEXT: [[R:%.*]] = call double @erf(double 0xFFF0000000000000) #[[ATTR0]]
117+
; CHECK-NEXT: [[R:%.*]] = call double @erf(double 0xFFF0000000000000) #[[ATTR1]]
124118
; CHECK-NEXT: ret double [[R]]
125119
;
126120
%r = call double @erf(double 0xFFF0000000000000) readnone
@@ -147,7 +141,7 @@ define double @erf_nan() {
147141

148142
define float @erff_nan_memory_none() {
149143
; CHECK-LABEL: define float @erff_nan_memory_none() {
150-
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 0x7FF8000000000000) #[[ATTR0]]
144+
; CHECK-NEXT: [[R:%.*]] = call float @erff(float 0x7FF8000000000000) #[[ATTR1]]
151145
; CHECK-NEXT: ret float [[R]]
152146
;
153147
%r = call float @erff(float 0x7FF8000000000000) readnone
@@ -156,7 +150,7 @@ define float @erff_nan_memory_none() {
156150

157151
define double @erf_nan_memory_none() {
158152
; CHECK-LABEL: define double @erf_nan_memory_none() {
159-
; CHECK-NEXT: [[R:%.*]] = call double @erf(double 0x7FF8000000000000) #[[ATTR0]]
153+
; CHECK-NEXT: [[R:%.*]] = call double @erf(double 0x7FF8000000000000) #[[ATTR1]]
160154
; CHECK-NEXT: ret double [[R]]
161155
;
162156
%r = call double @erf(double 0x7FF8000000000000) readnone
@@ -181,5 +175,5 @@ define double @erf_poison() {
181175
ret double %r
182176
}
183177

184-
declare float @erff(float)
185-
declare double @erf(double)
178+
declare float @erff(float) willreturn
179+
declare double @erf(double) willreturn

0 commit comments

Comments
 (0)