Skip to content

Commit 222eb25

Browse files
authored
[InferAttrs] Mark ceil and round as memory(none) (llvm#170694)
This probably should've been done in llvm#124742, but it wasn't. The floor, ceil, round, and trunc family of functions all behave the same.
1 parent 64e1991 commit 222eb25

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,9 +1227,6 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
12271227
case LibFunc_atanhf:
12281228
case LibFunc_atanhl:
12291229
case LibFunc_atanl:
1230-
case LibFunc_ceil:
1231-
case LibFunc_ceilf:
1232-
case LibFunc_ceill:
12331230
case LibFunc_cos:
12341231
case LibFunc_cosh:
12351232
case LibFunc_coshf:
@@ -1298,9 +1295,6 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
12981295
case LibFunc_rint:
12991296
case LibFunc_rintf:
13001297
case LibFunc_rintl:
1301-
case LibFunc_round:
1302-
case LibFunc_roundf:
1303-
case LibFunc_roundl:
13041298
case LibFunc_scalbln:
13051299
case LibFunc_scalblnf:
13061300
case LibFunc_scalblnl:
@@ -1338,6 +1332,9 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
13381332
case LibFunc_copysign:
13391333
case LibFunc_copysignf:
13401334
case LibFunc_copysignl:
1335+
case LibFunc_ceil:
1336+
case LibFunc_ceilf:
1337+
case LibFunc_ceill:
13411338
case LibFunc_fabs:
13421339
case LibFunc_fabsf:
13431340
case LibFunc_fabsl:
@@ -1361,6 +1358,9 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
13611358
case LibFunc_nearbyint:
13621359
case LibFunc_nearbyintf:
13631360
case LibFunc_nearbyintl:
1361+
case LibFunc_round:
1362+
case LibFunc_roundf:
1363+
case LibFunc_roundl:
13641364
case LibFunc_toascii:
13651365
case LibFunc_trunc:
13661366
case LibFunc_truncf:

llvm/test/Transforms/InferFunctionAttrs/annotate.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ declare float @cbrtf(float)
304304
; CHECK: declare x86_fp80 @cbrtl(x86_fp80) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
305305
declare x86_fp80 @cbrtl(x86_fp80)
306306

307-
; CHECK: declare double @ceil(double) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
307+
; CHECK: declare double @ceil(double) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
308308
declare double @ceil(double)
309309

310-
; CHECK: declare float @ceilf(float) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
310+
; CHECK: declare float @ceilf(float) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
311311
declare float @ceilf(float)
312312

313-
; CHECK: declare x86_fp80 @ceill(x86_fp80) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
313+
; CHECK: declare x86_fp80 @ceill(x86_fp80) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
314314
declare x86_fp80 @ceill(x86_fp80)
315315

316316
; The second argument of int chmod(FILE*, mode_t) is a 32-bit int on most
@@ -909,13 +909,13 @@ declare x86_fp80 @rintl(x86_fp80)
909909
; CHECK: declare noundef i32 @rmdir(ptr noundef readonly captures(none)) [[NOFREE_NOUNWIND]]
910910
declare i32 @rmdir(ptr)
911911

912-
; CHECK: declare double @round(double) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
912+
; CHECK: declare double @round(double) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
913913
declare double @round(double)
914914

915-
; CHECK: declare float @roundf(float) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
915+
; CHECK: declare float @roundf(float) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
916916
declare float @roundf(float)
917917

918-
; CHECK: declare x86_fp80 @roundl(x86_fp80) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
918+
; CHECK: declare x86_fp80 @roundl(x86_fp80) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
919919
declare x86_fp80 @roundl(x86_fp80)
920920

921921
; CHECK: declare double @scalbln(double, i64) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]

0 commit comments

Comments
 (0)