[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 13:22:13 PST 2022


erichkeane added a comment.

In D120266#3341378 <https://reviews.llvm.org/D120266#3341378>, @ibookstein wrote:

> Yeah, that's what happens with this patch; Reference binds against an `llvm::Function` declaration, linker resolves it to the actual ifunc in another translation unit and therefore emits IFUNC relocation.
>
> Thinking about it more, this is inelegant. I would have liked the reference against the `cpu_specific` to bind against a plain "FOO" function declaration and not "FOO.ifunc", and 'upgrade' it later once a cpu_dispatch is encountered.
> To my understanding, this is actually the reason https://reviews.llvm.org/D67058 added the plain-name alias.
>
> I'll try to see if I can rework that.

I was actually in favor of that... The problem is that the cpu-dispatch in a different TU should be what is found, and there is value to having the linker failure in that case.  I wouldn't want something like:

TU1:

  [[cpu_specific(generic)]]
  void foo(){}
  void caller() {
  foo();
  }

TU2:

  void foo() {
  some weirdo generic impl
  }

to work in this case.

The point of that other review was the inverse: someone who DIDN'T know about the multiversioning could get it.  We don't want this (not getting multiversioning even though you expect it!) to work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120266



More information about the cfe-commits mailing list