Skip to content

[FMV] incorrect codegen when there is no TU-local caller #81494

Closed
@jroelofs

Description

@jroelofs

https://clang.godbolt.org/z/heoTnxqz5

Compare:

__attribute__((target_version("dotprod+lse")))
int foo(void) { return 1; }

__attribute__((target_version("default")))
int foo(void) { return 0; }

#ifdef HAS_CALLER
int caller(void) { return foo(); }
#endif
--rtlib=compiler-rt -O2 -DHAS_CALLER=1

vs

--rtlib=compiler-rt -O2

While GCC's version has self-consistent and correct behavior, IMO it would be better to always emit the weak ifunc+resolver along with the definition of the default version so you can forward-declare the not-attributed version of the function and call these from any other TU.

Metadata

Metadata

Assignees

Labels

clang:codegenIR generation bugs: mangling, exceptions, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions