[llvm] 1c72c90 - [InferAttrs] Handle roundeven like other libm functions (#170691)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 09:50:24 PST 2025
Author: valadaptive
Date: 2025-12-04T17:50:19Z
New Revision: 1c72c90b8acd2069588eba0c568d5ffa2f6db2e9
URL: https://github.com/llvm/llvm-project/commit/1c72c90b8acd2069588eba0c568d5ffa2f6db2e9
DIFF: https://github.com/llvm/llvm-project/commit/1c72c90b8acd2069588eba0c568d5ffa2f6db2e9.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
llvm/test/Transforms/InferFunctionAttrs/annotate.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 213869fb993d7..05c882da38d61 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -1361,6 +1361,9 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
case LibFunc_round:
case LibFunc_roundf:
case LibFunc_roundl:
+ case LibFunc_roundeven:
+ case LibFunc_roundevenf:
+ case LibFunc_roundevenl:
case LibFunc_toascii:
case LibFunc_trunc:
case LibFunc_truncf:
diff --git a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
index 4a0a20b71dfde..f5020a93250ea 100644
--- a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
+++ b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
@@ -918,6 +918,15 @@ declare float @roundf(float)
; CHECK: declare x86_fp80 @roundl(x86_fp80) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
declare x86_fp80 @roundl(x86_fp80)
+; CHECK: declare double @roundeven(double) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
+declare double @roundeven(double)
+
+; CHECK: declare float @roundevenf(float) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
+declare float @roundevenf(float)
+
+; CHECK: declare x86_fp80 @roundevenl(x86_fp80) [[MEMNONE_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
+declare x86_fp80 @roundevenl(x86_fp80)
+
; CHECK: declare double @scalbln(double, i64) [[ERRNOMEMONLY_NOFREE_NOUNWIND_WILLRETURN:#[0-9]+]]
declare double @scalbln(double, i64)
More information about the llvm-commits
mailing list