[PATCH] D98516: [WIP] Introduce the "implements" string attribute
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 12 11:22:29 PST 2021
tra added a comment.
Nice.
And, also, a bit scary as it can potentially be used to replace an arbitrary function, not just a math intrinsic normally mapped to libcall.
I can see how it may be useful to allow function substitution for uses other than libm on GPUs, but it's also going to be way too easy to make a mess. E.g. if/when someone substitutes `@llvm.lifetime.start` or some other special purpose intrinsic llvm relies on.
Perhaps it would make sense to only allow whitelisted functions?
================
Comment at: llvm/test/Transforms/ImplementsAttrResolver/intrinsic_implementation.ll:6
+
+define internal float @my_sin(float %d) "implements"="llvm.sin.f32" {
+; CHECK-LABEL: @my_sin(
----------------
What happens if the function has different signature than that of the intrinsic?
================
Comment at: llvm/test/Transforms/ImplementsAttrResolver/intrinsic_implementation.ll:6
+
+define internal float @my_sin(float %d) "implements"="llvm.sin.f32" {
+; CHECK-LABEL: @my_sin(
----------------
tra wrote:
> What happens if the function has different signature than that of the intrinsic?
We may want to be able provide different implementations based on fast-math flags.
libdevice has few functions that have distinct fast-math implementations.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98516/new/
https://reviews.llvm.org/D98516
More information about the llvm-commits
mailing list