[all-commits] [llvm/llvm-project] b3fd2e: [Clang][FMV] Stop emitting implicit default versio...
Alexandros Lamprineas via All-commits
all-commits at lists.llvm.org
Mon Jun 2 03:04:23 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b3fd2ea88875e58c66dd67870ff822cedf2570cf
https://github.com/llvm/llvm-project/commit/b3fd2ea88875e58c66dd67870ff822cedf2570cf
Author: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
Date: 2025-06-02 (Mon, 02 Jun 2025)
Changed paths:
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/lib/Sema/SemaDeclAttr.cpp
M clang/test/AST/attr-target-version.c
M clang/test/CodeGen/AArch64/fmv-detection.c
A clang/test/CodeGen/AArch64/fmv-duplicate-mangled-name.c
M clang/test/CodeGen/AArch64/fmv-features.c
M clang/test/CodeGen/AArch64/fmv-resolver-emission.c
M clang/test/CodeGen/AArch64/mixed-target-attributes.c
M clang/test/CodeGen/attr-target-clones-aarch64.c
M clang/test/CodeGen/attr-target-version-riscv.c
M clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
M clang/test/CodeGenCXX/attr-target-version-riscv.cpp
M clang/test/Sema/attr-target-clones-aarch64.c
Log Message:
-----------
[Clang][FMV] Stop emitting implicit default version using target_clones. (#141808)
With the current behavior the following example yields a linker error:
"multiple definition of `foo.default'"
// Translation Unit 1
__attribute__((target_clones("dotprod, sve"))) int foo(void) { return 1; }
// Translation Unit 2
int foo(void) { return 0; }
__attribute__((target_version("dotprod"))) int foo(void);
__attribute__((target_version("sve"))) int foo(void);
int bar(void) { return foo(); }
That is because foo.default is generated twice. As a user I don't find
this particularly intuitive. If I wanted the default to be generated in
TU1 I'd rather write target_clones("dotprod, sve", "default")
explicitly.
When changing the code I noticed that the RISC-V target defers the
resolver emission when encountering a target_version definition. This
seems accidental since it only makes sense for AArch64, where we only
emit a resolver once we've processed the entire TU, and only if the
default version is present. I've changed this so that RISC-V immediately
emmits the resolver. I adjusted the codegen tests since the functions
now appear in a different order.
Implements https://github.com/ARM-software/acle/pull/377
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list