Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagation of target attributes when inlining #75

Open
cmuellner opened this issue May 6, 2024 · 1 comment
Open

Propagation of target attributes when inlining #75

cmuellner opened this issue May 6, 2024 · 1 comment

Comments

@cmuellner
Copy link
Collaborator

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.

@kito-cheng
Copy link
Collaborator

Could you open a bugzilla entry to GCC? I think it should fix on GCC 14 branch as well, having a bugzilla entry will make sure we remember to do that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants