[PATCH] D139163: Utils: Add utility pass to lower ifuncs

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 14:49:59 PST 2022


MaskRay added a comment.

In D139163#4014178 <https://reviews.llvm.org/D139163#4014178>, @arsenm wrote:

> In D139163#4014143 <https://reviews.llvm.org/D139163#4014143>, @MaskRay wrote:
>
>> Which language doesn't allow function pointers but supports the function pointer array made possibly by this patch?
>
> OpenCL forbids function pointers. If you use target_clones in clang, there's no function pointer in the source and the compiler takes care of everything. I want to patch up subtarget specific implementations of builtin functions. It's not for end users

(Unfamiliar with OpenCL)

D51650 <https://reviews.llvm.org/D51650>+D122958 <https://reviews.llvm.org/D122958> (target_clones) implement target_clones with ifunc and a fallback when `supportsIFunc() == false`.

There is some inefficiency that the resolver is repeatedly called.

  int __attribute__((target_clones("sse4.2, default"))) foo(void) { return 0; }
  // clang --target=x86_64-pc-fuchsia -O2 -S a.c   // newer than https://reviews.llvm.org/D127933

If we cache the resolver, do you still need ifunc?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139163/new/

https://reviews.llvm.org/D139163



More information about the llvm-commits mailing list