Issue 81494
Summary [FMV] incorrect codegen when there is no TU-local caller
Labels clang:codegen
Assignees
Reporter 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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to