[PATCH] D156136: [BPF] Clean up SelLowering
Tamir Duberstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 30 17:29:04 PDT 2023
tamird added a comment.
In D156136#4545381 <https://reviews.llvm.org/D156136#4545381>, @yonghong-song wrote:
> The error message is not what I envisioned.
>
> $ cat t.c
> struct t {
> int a;
> };
> struct t foo(int a, int b) {
> struct t tmp;
> tmp.a = a + b;
> return tmp;
> }
> $ clang --target=bpf -O2 -g -c t.c
> t.c:4:10: error: functions returning through a pointer parameter are not supported
> 4 | struct t foo(int a, int b) {
> | ^
> 1 error generated.
> $
>
> From source code perspective, there is no 'returning through a pointer parameter'.
> The source code shows 'returning a struct'.
> The error message can be 'functions returning a struct are not supported'.
>
> 'union' has the same issue,
>
> $ cat t.c
> union t {
> int a;
> int b;
> };
> union t foo(int a, int b) {
> union t tmp;
> tmp.a = a + b;
> return tmp;
> }
> $ clang --target=bpf -O2 -g -c t.c
> t.c:5:9: error: functions returning through a pointer parameter are not supported
> 5 | union t foo(int a, int b) {
> | ^
> 1 error generated.
> $
>
> In llvm IR, 'union' is represented as 'struct' as well.
>
> If you really want, the error message can be
> `functions returning a struct/union are not supported`.
Good point; I changed this wording to match the return-struct-in-registers wording. I was trying to distinguish these messages, but there's no need, they are the same from the user's perspective.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156136/new/
https://reviews.llvm.org/D156136
More information about the llvm-commits
mailing list