[LLVMdev] making a copy of a byval aggregate on the callee's frame

Tim Northover t.p.northover at gmail.com
Thu Jul 4 23:43:22 PDT 2013

Hi Robert,

> This should ideally be done early on in the IR in my thinking - to allow optimisation if the data is only ever read.

I've thought that once or twice when dealing with ABIs myself. That's
certainly another possibility in your case. You could create a
separate FunctionPass that gets executed early on and replaces all
byval calls and functions with the correct memcpys.

It wouldn't work for other targets because they need more control over
just where the copy ends up, but it sounds like you shouldn't have an

> So, can it be done in the llvm?

Yes, in multiple ways.

> Should it be done in the llvm?

I think so, one way or the other.


More information about the llvm-dev mailing list