[clang] [FMV] Emit the resolver along with the default version definition. (PR #84405)

Alexandros Lamprineas via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 17 15:34:10 PDT 2024


labrinea wrote:

> In the current patch, it just gets the non-mangled name. And the fact that we get a not-mangled function that uses `feature` without going through a resolver is concerning to me.

I am not sure I understand. Are you refering to the StringSet I added which keeps non-mangled names of versioned functions? Those unique non-mangled names will be appended to `MultiVersionFuncs` which are iterated by the outer loop of `CodeGenModule::emitMultiVersionFunctions()`. Then for each of these declarations there is a chain of declarations (mangled function versions), which is iterated by the inner loop (forEachMultiversionedFunctionVersion). In that inner loop we either create (emit) a version or we just get a reference to its declaration. All these mangled versions that are part of the chain and are passed to `EmitMultiVersionResolver()` via `Options`. The reason we are using a Set is to avoid duplicates in the outer loop, which would result in multiple copies of the corresponding basic blocks in the resolver's body. Oh, and btw the default versions always have an implicit target_version attribute by the time they are processed by emitMultiVersionFunctions (added by the sema checker), so they are already mangled. I am not sure I answered. Perhaps we could decipher the concern offline.



https://github.com/llvm/llvm-project/pull/84405


More information about the cfe-commits mailing list