Open
Description
I just came across a difference in GCC and LLVM w.r.t. propagation of function attributes when inlining.
E.g., consider the following code (built with -O3 -march=rv64gc
):
#define always_inline __attribute__((always_inline))
always_inline inline int get_elem(int *p, int n)
{
return p[n];
}
__attribute__((target("arch=+zba")))
int get_elem_fast(int *p, int n)
{
return get_elem(p, n);
}
LLVM inlines as advised and produces:
get_elem_fast: # @get_elem_fast
sh2add a0, a1, a0
lw a0, 0(a0)
ret
GCC errors out with: error: inlining failed in call to 'always_inline' 'get_elem': target specific option mismatch
.
Probably there is nothing that can be done here. Still, I wanted to raise attention about that.
Metadata
Assignees
Labels
No labels