[PATCH] D156136: [BPF] Clean up SelLowering
Tamir Duberstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 30 04:52:18 PDT 2023
tamird added inline comments.
================
Comment at: llvm/lib/Target/BPF/BPFISelLowering.cpp:379
+ if (MF.getFunction().hasStructRetAttr())
+ fail(DL, DAG, "sret functions are not supported");
----------------
eddyz87 wrote:
> tamird wrote:
> > yonghong-song wrote:
> > > User may not understand what 'sret' means without looking at source code.
> > > Maybe 'functions with returning struct are not supported'?
> > Thanks, I agree this error message is not very clear. I'd like to update it, but I notice that the existing tests do not cover it. Do you know how to write a function that would produce IR with the `sret` attribute?
> The following C code sample:
>
> ```
> struct bar { long a[100]; };
> struct bar foo(void) {
> struct bar b;
> return b;
> }
> ```
>
> Produces IR that triggers the error:
>
> ```
> $ clang -mcpu=v4 -O2 --target=bpf -S test3.c -emit-llvm -o -
> ...
> %struct.bar = type { [100 x i64] }
>
> ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
> define dso_local void @foo(ptr noalias nocapture sret(%struct.bar) align 8 %agg.result) local_unnamed_addr #0 {
> entry:
> ret void
> }
> ...
> $ clang -mcpu=v4 -O2 --target=bpf -S test3.c -emit-llvm -o - | llc
> ...
> error: <unknown>:0:0: in function foo void (ptr): functions with VarArgs or StructRet are not supported
> ...
> ```
Thanks! Done.
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