Skip to content

Commit a1d9878

Browse files
valadaptivegithub-actions[bot]
authored andcommitted
Automerge: [InferAttrs] Handle roundeven like other libm functions (#170691)
It was previously missing entirely. It behaves like floor, ceil, round, and trunc, having no side effects.
2 parents e62071b + 1c72c90 commit a1d9878

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,9 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
13611361
case LibFunc_round:
13621362
case LibFunc_roundf:
13631363
case LibFunc_roundl:
1364+
case LibFunc_roundeven:
1365+
case LibFunc_roundevenf:
1366+
case LibFunc_roundevenl:
13641367
case LibFunc_toascii:
13651368
case LibFunc_trunc:
13661369
case LibFunc_truncf:

llvm/test/Transforms/InferFunctionAttrs/annotate.ll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,15 @@ declare float @roundf(float)
918918
; CHECK: declare x86_fp80 @roundl(x86_fp80) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
919919
declare x86_fp80 @roundl(x86_fp80)
920920

921+
; CHECK: declare double @roundeven(double) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
922+
declare double @roundeven(double)
923+
924+
; CHECK: declare float @roundevenf(float) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
925+
declare float @roundevenf(float)
926+
927+
; CHECK: declare x86_fp80 @roundevenl(x86_fp80) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
928+
declare x86_fp80 @roundevenl(x86_fp80)
929+
921930
; CHECK: declare double @scalbln(double, i64) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
922931
declare double @scalbln(double, i64)
923932

0 commit comments

Comments
 (0)