[llvm-dev] SRET consistency between declaration and call site
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Thu Oct 8 07:15:36 PDT 2015
On 8 October 2015 at 03:31, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:
> I think we are talking about two different things here. What I am
> advocating is that callsite and function signature must have matching
> ABI. I think we already enforce that for things like argument type, so
> enforcing sret doesn't seem to be any different. I am not saying that
> you should not be able to override it via manual bitcasting, but that's
> a completely different topic. If you do that, you are on your own.
Unfortunately the two aren't separable because the sret isn't part of
the function's type. You can't even write down a bitcast that adds or
removes it:
$ cat simple.ll
define void @foo(void(i8*)* %fn) {
%tst = bitcast void(i8*)* %fn to void(i8* sret)*
ret void
}
$ opt -verify simple.ll -S
opt: simple.ll:2:41: error: argument attributes invalid in function type
%tst = bitcast void(i8*)* %fn to void(i8* sret)*
So if you ban mismatches at call sites, you're banning the casts too.
Cheers.
Tim.
More information about the llvm-dev
mailing list